Resolve user and group names in related opts

def _resolve_user_group_names(opts):
    '''
    Resolve user and group names in related opts
    '''
    name_id_opts = {'uid': 'user.info',
                    'gid': 'group.info'}
    for ind, opt in enumerate(opts):
        if opt.split('=')[0] in name_id_opts:
            _givenid = opt.split('=')[1]
            _param = opt.split('=')[0]
            _id = _givenid
            if not re.match('[0-9]+$', _givenid):
                _info = __salt__[name_id_opts[_param]](_givenid)
                if _info and _param in _info:
                    _id = _info[_param]
            opts[ind] = _param + '=' + six.text_type(_id)
        opts[ind] = opts[ind].replace('\\040', '\\ ')
    return opts