def verify_resource_dict(res_dict, is_create, attr_info):
if ((bc.NEUTRON_VERSION >= bc.NEUTRON_NEWTON_VERSION) and '<STR_LIT>'<EOL>in res_dict):<EOL><INDENT>res_dict['<STR_LIT>'] = res_dict['<STR_LIT>']<EOL><DEDENT>if is_create:  <EOL><INDENT>for attr, attr_vals in six.iteritems(attr_info):<EOL><INDENT>if attr_vals['<STR_LIT>']:<EOL><INDENT>if '<STR_LIT:default>' not in attr_vals and attr not in res_dict:<EOL><INDENT>msg = _("<STR_LIT>"<EOL>"<STR_LIT>") % attr<EOL>raise webob.exc.HTTPBadRequest(msg)<EOL><DEDENT>res_dict[attr] = res_dict.get(attr, attr_vals.get('<STR_LIT:default>'))<EOL><DEDENT>else:<EOL><INDENT>if attr in res_dict:<EOL><INDENT>msg = _("<STR_LIT>") % attr<EOL>raise webob.exc.HTTPBadRequest(msg)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:  <EOL><INDENT>for attr, attr_vals in six.iteritems(attr_info):<EOL><INDENT>if attr in res_dict and not attr_vals['<STR_LIT>']:<EOL><INDENT>msg = _("<STR_LIT>") % attr<EOL>raise webob.exc.HTTPBadRequest(msg)<EOL><DEDENT><DEDENT><DEDENT>for attr, attr_vals in six.iteritems(attr_info):<EOL><INDENT>if (attr not in res_dict or<EOL>res_dict[attr] is bc.constants.ATTR_NOT_SPECIFIED):<EOL><INDENT>continue<EOL><DEDENT>if '<STR_LIT>' in attr_vals:<EOL><INDENT>res_dict[attr] = attr_vals['<STR_LIT>'](res_dict[attr])<EOL><DEDENT>if '<STR_LIT>' not in attr_vals:<EOL><INDENT>continue<EOL><DEDENT>for rule in attr_vals['<STR_LIT>']:<EOL><INDENT>_ensure_format(rule, attr, res_dict)<EOL>res = bc.validators[rule](res_dict[attr],<EOL>attr_vals['<STR_LIT>'][rule])<EOL>if res:<EOL><INDENT>msg_dict = dict(attr=attr, reason=res)<EOL>msg = (_("<STR_LIT>") %<EOL>msg_dict)<EOL>raise webob.exc.HTTPBadRequest(msg)<EOL><DEDENT><DEDENT><DEDENT>return res_dict<EOL>
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.