import yaml
import pkg_resources


def get_schema(schema_stream = None):
    """
    Returns the inbuilt model schema
    """

    # INBUILT = pkg_resources.resource_stream(__name__, 'schema.yml')

    if schema_stream:
        schema = yaml.unsafe_load(schema_stream)
    else:
        with pkg_resources.resource_stream(__name__, 'schema.yml') as INBUILT:
            schema = yaml.unsafe_load(INBUILT)

    return schema