def extend_with_default(validator_class: Any) -> Any:
    """Append defaults from schema to instance need to be validated.

    :param validator_class: Apply the change for given validator class.
    """
    validate_properties = validator_class.VALIDATORS['properties']

    def set_defaults(validator: Any,
                     properties: dict,
                     instance: dict,
                     schema: dict) -> Iterator[ValidationError]:
        for prop, subschema in properties.items():
            if 'default' in subschema:
                instance.setdefault(prop, subschema['default'])

        for error in validate_properties(
            validator, properties, instance, schema,
        ):
            yield error  # pragma: no cover

    return extend(validator_class, {'properties': set_defaults})
Append defaults from schema to instance need to be validated.

    :param validator_class: Apply the change for given validator class.