<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_config_dir():
 """ Return tmuxp configuration directory. ``TMUXP_CONFIGDIR`` environmental variable has precedence if set. We also evaluate XDG default directory from XDG_CONFIG_HOME environmental variable if set or its default. Then the old default ~/.tmuxp is returned for compatibility. Returns ------- str : absolute path to tmuxp config directory """


    paths = []
    if 'TMUXP_CONFIGDIR' in os.environ:
        paths.append(os.environ['TMUXP_CONFIGDIR'])
    if 'XDG_CONFIG_HOME' in os.environ:
        paths.append(os.environ['XDG_CONFIG_HOME'])
    else:
        paths.append('~/.config/tmuxp/')
    paths.append('~/.tmuxp')

    for path in paths:
        path = os.path.expanduser(path)
        if os.path.isdir(path):
            return path
    # Return last path as default if none of the previous ones matched
    return path