Expands ~/path to /home/<current_user>/path

    On POSIX systems does it by getting the home directory for the
    current effective user from the passwd database. On other systems
    do it by using :func:`os.path.expanduser`

    Args:
        path (str): A path to expand to a user's home folder

    Returns:
        str: expanded path

def expand_user(path):
    """Expands ~/path to /home/<current_user>/path

    On POSIX systems does it by getting the home directory for the
    current effective user from the passwd database. On other systems
    do it by using :func:`os.path.expanduser`

    Args:
        path (str): A path to expand to a user's home folder

    Returns:
        str: expanded path
    """
    if not path.startswith('~'):
        return path

    if os.name == 'posix':
        user = pwd.getpwuid(os.geteuid())
        return path.replace('~', user.pw_dir, 1)
    else:
        return os.path.expanduser(path)