def dict_of(validate_key, validate_item):
def validate(value, should_raise=True):<EOL><INDENT>validate_type = is_type(dict)<EOL>if not validate_type(value, should_raise=should_raise):<EOL><INDENT>return False<EOL><DEDENT>for key, item in value.items():<EOL><INDENT>try:<EOL><INDENT>validate_key(key)<EOL><DEDENT>except TypeError as e:<EOL><INDENT>if should_raise:<EOL><INDENT>samtranslator.model.exceptions.prepend(e, "<STR_LIT>")<EOL>raise<EOL><DEDENT>return False<EOL><DEDENT>try:<EOL><INDENT>validate_item(item)<EOL><DEDENT>except TypeError as e:<EOL><INDENT>if should_raise:<EOL><INDENT>samtranslator.model.exceptions.prepend(e, "<STR_LIT>")<EOL>raise<EOL><DEDENT>return False<EOL><DEDENT><DEDENT>return True<EOL><DEDENT>return validate<EOL>
Returns a validator function that succeeds only if the input is a dict, and each key and value in the dict passes
    as input to the provided validators validate_key and validate_item, respectively.

    :param callable validate_key: the validator function for keys in the dict
    :param callable validate_item: the validator function for values in the list
    :returns: a function which returns True its input is an dict of valid items, and raises TypeError otherwise
    :rtype: callable