def _get_validator(name, schema=None, check_schema=True,<EOL>validator_class=None, **validator_kwargs):
if schema is None:<EOL><INDENT>try:<EOL><INDENT>schema = _SCHEMAS[name]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise SchemaValidationError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>if name not in _VALIDATORS:<EOL><INDENT>if validator_class is None:<EOL><INDENT>validator_class = jsonschema.validators.validator_for(schema)<EOL><DEDENT>_VALIDATORS[name] = validator_class(schema, **validator_kwargs)<EOL><DEDENT>validator = _VALIDATORS[name]<EOL>if check_schema:<EOL><INDENT>validator.check_schema(schema)<EOL><DEDENT>return validator<EOL>
Generate validator for JSON schema.

    Args:
        name (str): Name for validator. Will be validator key in
            `_VALIDATORS` dict.
        schema (dict): JSON schema `dict`. If not provided searches for schema
            in `_SCHEMAS`.
        check_schema (bool): Verify schema is valid.
        validator_class (jsonschema.IValidator): jsonschema IValidator instance.
            Default behavior is to determine this from the schema `$schema`
            field.
        **validator_kwargs (dict): Additional keyword arguments for validator.

    Return:
        jsonschema.IValidator: Validator for JSON schema.

    Raises:
        SchemaValidationError: Raised if validation fails.