<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_object(obj, field_validators=None, non_field_validators=None, schema=None, context=None):
 """ Takes a mapping and applies a mapping of validator functions to it collecting and reraising any validation errors that occur. """

    if schema is None:
        schema = {}
    if context is None:
        context = {}
    if field_validators is None:
        field_validators = ValidationDict()
    if non_field_validators is None:
        non_field_validators = ValidationList()

    from flex.validation.schema import (
        construct_schema_validators,
    )
    schema_validators = construct_schema_validators(schema, context)
    if '$ref' in schema_validators and hasattr(schema_validators['$ref'], 'validators'):
        ref_ = field_validators.pop('$ref')
        for k, v in ref_.validators.items():
            if k not in schema_validators:
                schema_validators.add_validator(k, v)

    if 'discriminator' in schema:
        schema_validators = add_polymorphism_requirements(obj, schema, context, schema_validators)
        # delete resolved discriminator to avoid infinite recursion
        del schema['discriminator']

    schema_validators.update(field_validators)
    schema_validators.validate_object(obj, context=context)
    non_field_validators.validate_object(obj, context=context)
    return obj