def getSegmentFromPath(path, pathIndex):
 if (len(path) < 2):
  return None
 begin = path[(-1)]
 end = path[(-2)]
 forwardEndpoint = getEndpointFromPath(path, pathIndex)
 reversePath = path[:]
 reversePath.reverse()
 reverseEndpoint = getEndpointFromPath(reversePath, pathIndex)
 return (forwardEndpoint, reverseEndpoint)

def getSegmentFromPath ( path , pathIndex ) : if ( len ( path ) < 2 ) : return None begin = path [ ( - 1 ) ] end = path [ ( - 2 ) ] forwardEndpoint = getEndpointFromPath ( path , pathIndex ) reversePath = path [ : ] reversePath . reverse ( ) reverseEndpoint = getEndpointFromPath ( reversePath , pathIndex ) return ( forwardEndpoint , reverseEndpoint )
get endpoint segment from a path .