<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def installed(name, default=False, user=None):
    '''
    Verify that the specified python is installed with pyenv. pyenv is
    installed if necessary.

    name
        The version of python to install

    default : False
        Whether to make this python the default.

    user: None
        The user to run pyenv as.

        .. versionadded:: 0.17.0

    .. versionadded:: 0.16.0
    '''
    ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

    if name.startswith('python-'):
        name = re.sub(r'^python-', '', name)

    if __opts__['test']:
        ret['comment'] = 'python {0} is set to be installed'.format(name)
        return ret

    ret = _check_pyenv(ret, user)
    if ret['result'] is False:
        if not __salt__['pyenv.install'](user):
            ret['comment'] = 'pyenv failed to install'
            return ret
        else:
            return _check_and_install_python(ret, name, default, user=user)
    else:
        return _check_and_install_python(ret, name, default, user=user)