def unfrackpath(path, follow=True):
 if follow:
  final_path = os.path.normpath(os.path.realpath(os.path.expanduser(os.path.expandvars(to_bytes(path, errors='surrogate_or_strict')))))
 else:
  final_path = os.path.normpath(os.path.abspath(os.path.expanduser(os.path.expandvars(to_bytes(path, errors='surrogate_or_strict')))))
 return to_text(final_path, errors='surrogate_or_strict')

def unfrackpath ( path , follow = True ) : if follow : final_path = os . path . normpath ( os . path . realpath ( os . path . expanduser ( os . path . expandvars ( to_bytes ( path , errors = 'surrogate_or_strict' ) ) ) ) ) else : final_path = os . path . normpath ( os . path . abspath ( os . path . expanduser ( os . path . expandvars ( to_bytes ( path , errors = 'surrogate_or_strict' ) ) ) ) ) return to_text ( final_path , errors = 'surrogate_or_strict' )
returns a path that is free of symlinks .