code: def expanduser(path):
      # type: (str) -> str
      
      expanded = os.path.expanduser(path)
      if path.startswith('~/') and expanded.startswith('//'):
          expanded = expanded[1:]
      return expanded
docs: Expand ~ and ~user constructions.
  
      Includes a workaround for https://bugs.python.org/issue14768