<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _expand_path(path):
 """Expand both environment variables and user home in the given path."""

    path = os.path.expandvars(path)
    path = os.path.expanduser(path)
    return path