code: def realpath(path):
      
      if path == '~':
          return userdir
  
      if path == '/':
          return sysroot
  
      if path.startswith('/'):
          return os.path.abspath(path)
  
      if path.startswith('~/'):
          return os.path.expanduser(path)
  
      if path.startswith('./'):
          return os.path.abspath(os.path.join(os.path.curdir, path[2:]))
  
      return os.path.abspath(path)
docs: Create the real absolute path for the given path.
  
      Add supports for userdir & / supports.
  
      Args:
          * path: pathname to use for realpath.
  
      Returns:
          Platform independent real absolute path.