def _resolve_link(path):
 paths_seen = set()
 while islink(path):
  if (path in paths_seen):
   return None
  paths_seen.add(path)
  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 ) : return None paths_seen . add ( path ) resolved = os . readlink ( path ) if ( not isabs ( resolved ) ) : dir = dirname ( path ) path = normpath ( join ( dir , resolved ) ) else : path = normpath ( resolved ) return path
internal helper function .