human
Complete the below
def expandvars(path):

    ''''Args:
    path (pathlike): A path to expand
    Returns:
    `fsnative`
    Like :func:`python:os.path.expandvars` but supports unicode under Windows
    + Python 2 and always returns a `fsnative`.'
    '''
 What is a the Python code you requested?
assistant
#Here is the Python code you requested.
    path = path2fsn(path)
    def repl_func(match):
        return environ.get(match.group(1), match.group(0))
    path = re.compile('\\$(\\w+)', flags=re.UNICODE).sub(repl_func, path)
    if (os.name == 'nt'):
        path = re.sub('%([^%]+)%', repl_func, path)
    return re.sub('\\$\\{([^\\}]+)\\}', repl_func, path)