Expand ~ and ~user constructions.

    Includes a workaround for https://bugs.python.org/issue14768

def expanduser(path):
    # type: (str) -> str
    """
    Expand ~ and ~user constructions.

    Includes a workaround for https://bugs.python.org/issue14768
    """
    expanded = os.path.expanduser(path)
    if path.startswith('~/') and expanded.startswith('//'):
        expanded = expanded[1:]
    return expanded