<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, opts=None, env=None):
    '''
    Verify that the specified ruby is installed with RVM. RVM is
    installed when necessary.

    name
        The version of ruby to install

    default : False
        Whether to make this ruby the default.

    user: None
        The user to run rvm as.

    env: None
        A list of environment variables to set (ie, RUBY_CONFIGURE_OPTS)

    opts: None
        A list of option flags to pass to RVM (ie -C, --patch)

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

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

    ret = _check_rvm(ret, user)
    if ret['result'] is False:
        if not __salt__['rvm.install'](runas=user):
            ret['comment'] = 'RVM failed to install.'
            return ret
        else:
            return _check_and_install_ruby(ret, name, default, user=user, opts=opts, env=env)
    else:
        return _check_and_install_ruby(ret, name, default, user=user, opts=opts, env=env)