def transferClosestFillLoop(extrusionHalfWidth, oldOrderedLocation, remainingFillLoops, skein):
 closestDistance = 9.876543219876543e+17
 closestFillLoop = None
 for remainingFillLoop in remainingFillLoops:
  distance = getClosestDistanceIndexToLine(oldOrderedLocation.dropAxis(), remainingFillLoop).distance
  if (distance < closestDistance):
   closestDistance = distance
   closestFillLoop = remainingFillLoop
 newClosestFillLoop = getLoopInsideContainingLoop(closestFillLoop, remainingFillLoops)
 while (newClosestFillLoop != None):
  closestFillLoop = newClosestFillLoop
  newClosestFillLoop = getLoopInsideContainingLoop(closestFillLoop, remainingFillLoops)
 remainingFillLoops.remove(closestFillLoop)
 addToThreadsFromLoop(extrusionHalfWidth, 'loop', closestFillLoop[:], oldOrderedLocation, skein)

def transferClosestFillLoop ( extrusionHalfWidth , oldOrderedLocation , remainingFillLoops , skein ) : closestDistance = 9.876543219876543e+17 closestFillLoop = None for remainingFillLoop in remainingFillLoops : distance = getClosestDistanceIndexToLine ( oldOrderedLocation . dropAxis ( ) , remainingFillLoop ) . distance if ( distance < closestDistance ) : closestDistance = distance closestFillLoop = remainingFillLoop newClosestFillLoop = getLoopInsideContainingLoop ( closestFillLoop , remainingFillLoops ) while ( newClosestFillLoop != None ) : closestFillLoop = newClosestFillLoop newClosestFillLoop = getLoopInsideContainingLoop ( closestFillLoop , remainingFillLoops ) remainingFillLoops . remove ( closestFillLoop ) addToThreadsFromLoop ( extrusionHalfWidth , 'loop' , closestFillLoop [ : ] , oldOrderedLocation , skein )
transfer the closest remaining fill loop .