<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def verify_resource_dict(res_dict, is_create, attr_info):
 """Verifies required attributes are in resource dictionary, res_dict. Also checking that an attribute is only specified if it is allowed for the given operation (create/update). Attribute with default values are considered to be optional. This function contains code taken from function 'prepare_request_body' in attributes.py. """

    if ((bc.NEUTRON_VERSION >= bc.NEUTRON_NEWTON_VERSION) and 'tenant_id'
            in res_dict):
        res_dict['project_id'] = res_dict['tenant_id']
    if is_create:  # POST
        for attr, attr_vals in six.iteritems(attr_info):
            if attr_vals['allow_post']:
                if 'default' not in attr_vals and attr not in res_dict:
                    msg = _("Failed to parse request. Required attribute '%s' "
                            "not specified") % attr
                    raise webob.exc.HTTPBadRequest(msg)
                res_dict[attr] = res_dict.get(attr, attr_vals.get('default'))
            else:
                if attr in res_dict:
                    msg = _("Attribute '%s' not allowed in POST") % attr
                    raise webob.exc.HTTPBadRequest(msg)
    else:  # PUT
        for attr, attr_vals in six.iteritems(attr_info):
            if attr in res_dict and not attr_vals['allow_put']:
                msg = _("Cannot update read-only attribute %s") % attr
                raise webob.exc.HTTPBadRequest(msg)

    for attr, attr_vals in six.iteritems(attr_info):
        if (attr not in res_dict or
                res_dict[attr] is bc.constants.ATTR_NOT_SPECIFIED):
            continue
        # Convert values if necessary
        if 'convert_to' in attr_vals:
            res_dict[attr] = attr_vals['convert_to'](res_dict[attr])
        # Check that configured values are correct
        if 'validate' not in attr_vals:
            continue
        for rule in attr_vals['validate']:
            _ensure_format(rule, attr, res_dict)
            res = bc.validators[rule](res_dict[attr],
                                      attr_vals['validate'][rule])
            if res:
                msg_dict = dict(attr=attr, reason=res)
                msg = (_("Invalid input for %(attr)s. Reason: %(reason)s.") %
                       msg_dict)
                raise webob.exc.HTTPBadRequest(msg)
    return res_dict