def getIndexedLoopFromIndexedGrid(indexedGrid):
 indexedLoop = indexedGrid[0][:]
 for row in indexedGrid[1:(-1)]:
  indexedLoop.append(row[(-1)])
 indexedLoop += indexedGrid[(-1)][::(-1)]
 for row in indexedGrid[(len(indexedGrid) - 2):0:(-1)]:
  indexedLoop.append(row[0])
 return indexedLoop

def getIndexedLoopFromIndexedGrid ( indexedGrid ) : indexedLoop = indexedGrid [ 0 ] [ : ] for row in indexedGrid [ 1 : ( - 1 ) ] : indexedLoop . append ( row [ ( - 1 ) ] ) indexedLoop += indexedGrid [ ( - 1 ) ] [ : : ( - 1 ) ] for row in indexedGrid [ ( len ( indexedGrid ) - 2 ) : 0 : ( - 1 ) ] : indexedLoop . append ( row [ 0 ] ) return indexedLoop
get indexed loop from around the indexed grid .