def _validate_example(rh, method, example_type):
example = getattr(method, example_type + "<STR_LIT>")<EOL>schema = getattr(method, example_type + "<STR_LIT>")<EOL>if example is None:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>validate(example, schema)<EOL><DEDENT>except ValidationError as e:<EOL><INDENT>raise ValidationError(<EOL>"<STR_LIT>".format(<EOL>example_type, rh.__name__, method.__name__, str(e)<EOL>)<EOL>)<EOL><DEDENT>return json.dumps(example, indent=<NUM_LIT:4>, sort_keys=True)<EOL>
Validates example against schema

    :returns: Formatted example if example exists and validates, otherwise None
    :raises ValidationError: If example does not validate against the schema