def _follow_symlinks(filepath):
 filepath = os.path.abspath(filepath)
 while os.path.islink(filepath):
  filepath = os.path.normpath(os.path.join(os.path.dirname(filepath), os.readlink(filepath)))
 return filepath

def _follow_symlinks ( filepath ) : filepath = os . path . abspath ( filepath ) while os . path . islink ( filepath ) : filepath = os . path . normpath ( os . path . join ( os . path . dirname ( filepath ) , os . readlink ( filepath ) ) ) return filepath
in case filepath is a symlink .