Parse a val schema definition.

def parse_schema(schema):
    """Parse a val schema definition."""

    if isinstance(schema, BaseSchema):
        return schema.validate

    if type(schema) is type:
        return _build_type_validator(schema)

    if isinstance(schema, dict):
        return _build_dict_validator(schema)

    if type(schema) in (list, tuple, set):
        return _build_iterable_validator(schema)

    if callable(schema):
        return _build_callable_validator(schema)

    return _build_static_validator(schema)