I have been trying to optimise this, but since each if has its own condition, i am not able to reduce its complexity
for () in ():
if ():
if ():
#Logical condition
if ():
#Logical condition
else:
#Logical condition
#another condition
if ():
if ():
if ():
#Logical condition
if index in ():
#Logical condition
ifin a row should be combined with&.if cond1: if cond2: if cond3is the same asif cond1 & cond2 & cond3: