The optimal CutOff value is the point where there is high true positive rate and low false positive rate. According to this logic, you can use the below code to get the value:
optimal_idx = np.argmax(tpr - fpr)
optimal_threshold = thresholds[optimal_idx]