def make_base_for_prefix(
    base: Type[T],
    table_prefix: str = core_db.DEFAULT_DATABASE_PREFIX,
) -> Type[T]:
    """
    Create a base class for ORM classes with the given table name prefix.

    Args:
        base: Base class to extend. Should be a subclass of
            [BaseWithTablePrefix][trulens.core.database.orm.BaseWithTablePrefix].

        table_prefix: Prefix to use for table names.

    Returns:
        A class that extends `base_type` and sets the table prefix to `table_prefix`.
    """

    if not hasattr(base, "_table_base_name"):
        raise ValueError(
            "Expected `base` to be a subclass of `BaseWithTablePrefix`."
        )

    # sqlalchemy stores a mapping of class names to the classes we defined in
    # the ORM above. Here we want to create a class with the specific name
    # matching base_type hence use `type` instead of `class SomeName: ...`.
    return type(base.__name__, (base,), {"_table_prefix": table_prefix})

    Create a base class for ORM classes with the given table name prefix.

    Args:
        base: Base class to extend. Should be a subclass of
            [BaseWithTablePrefix][trulens.core.database.orm.BaseWithTablePrefix].

        table_prefix: Prefix to use for table names.

    Returns:
        A class that extends `base_type` and sets the table prefix to `table_prefix`.
    
src/core/trulens/core/database/orm.py