def getOrderedNestedRings(nestedRings):
 insides = []
 orderedNestedRings = []
 for loopIndex in xrange(len(nestedRings)):
  nestedRing = nestedRings[loopIndex]
  otherLoops = []
  for beforeIndex in xrange(loopIndex):
   otherLoops.append(nestedRings[beforeIndex].boundary)
  for afterIndex in xrange((loopIndex + 1), len(nestedRings)):
   otherLoops.append(nestedRings[afterIndex].boundary)
  if isPathEntirelyInsideLoops(otherLoops, nestedRing.boundary):
   insides.append(nestedRing)
  else:
   orderedNestedRings.append(nestedRing)
 for outside in orderedNestedRings:
  outside.getFromInsideSurroundings(insides)
 return orderedNestedRings

def getOrderedNestedRings ( nestedRings ) : insides = [ ] orderedNestedRings = [ ] for loopIndex in xrange ( len ( nestedRings ) ) : nestedRing = nestedRings [ loopIndex ] otherLoops = [ ] for beforeIndex in xrange ( loopIndex ) : otherLoops . append ( nestedRings [ beforeIndex ] . boundary ) for afterIndex in xrange ( ( loopIndex + 1 ) , len ( nestedRings ) ) : otherLoops . append ( nestedRings [ afterIndex ] . boundary ) if isPathEntirelyInsideLoops ( otherLoops , nestedRing . boundary ) : insides . append ( nestedRing ) else : orderedNestedRings . append ( nestedRing ) for outside in orderedNestedRings : outside . getFromInsideSurroundings ( insides ) return orderedNestedRings
get ordered nestedrings from nestedrings .