(path)
return path
Internal helper function.  Takes a path and follows symlinks
    until we either arrive at something that isn't a symlink, or
    encounter a path we've seen before (meaning that there's a loop).
Internal helper function.  Takes a path and follows symlinks
    until we either arrive at something that isn't a symlink, or
    encounter a path we've seen before (meaning that there's a loop).
Internal helper function . Takes a path and follows symlinks until we either arrive at something that isn t a symlink or encounter a path we ve seen before ( meaning that there s a loop ) .
def _resolve_link(path):
    """Internal helper function.  Takes a path and follows symlinks
    until we either arrive at something that isn't a symlink, or
    encounter a path we've seen before (meaning that there's a loop).
    """
    paths_seen = set()
    while islink(path):
        if path in paths_seen:
            # Already seen this path, so we must have a symlink loop
            return None
        paths_seen.add(path)
        # Resolve where the link points to
        resolved = os.readlink(path)
        if not isabs(resolved):
            dir = dirname(path)
            path = normpath(join(dir, resolved))
        else:
            path = normpath(resolved)
    return path
def _resolve_link ( path ) : paths_seen = set ( ) while islink ( path ) : if path in paths_seen : # Already seen this path, so we must have a symlink loop return None paths_seen . add ( path ) # Resolve where the link points to resolved = os . readlink ( path ) if not isabs ( resolved ) : dir = dirname ( path ) path = normpath ( join ( dir , resolved ) ) else : path = normpath ( resolved ) return path