def bytestring_path(path):
 if isinstance(path, bytes):
  return path
 if ((os.path.__name__ == 'ntpath') and path.startswith(WINDOWS_MAGIC_PREFIX)):
  path = path[len(WINDOWS_MAGIC_PREFIX):]
 try:
  return path.encode(_fsencoding())
 except (UnicodeError, LookupError):
  return path.encode('utf-8')

def bytestring_path ( path ) : if isinstance ( path , bytes ) : return path if ( ( os . path . __name__ == 'ntpath' ) and path . startswith ( WINDOWS_MAGIC_PREFIX ) ) : path = path [ len ( WINDOWS_MAGIC_PREFIX ) : ] try : return path . encode ( _fsencoding ( ) ) except ( UnicodeError , LookupError ) : return path . encode ( 'utf-8' )
given a path .