def getInsidesAddToOutsides(loops, outsides):
 insides = []
 for loopIndex in xrange(len(loops)):
  loop = loops[loopIndex]
  if isInsideOtherLoops(loopIndex, loops):
   insides.append(loop)
  else:
   outsides.append(loop)
 return insides

def getInsidesAddToOutsides ( loops , outsides ) : insides = [ ] for loopIndex in xrange ( len ( loops ) ) : loop = loops [ loopIndex ] if isInsideOtherLoops ( loopIndex , loops ) : insides . append ( loop ) else : outsides . append ( loop ) return insides
add loops to either the insides or outsides .