def module_getattr_override(
    module: Optional[str] = None, message: Optional[str] = None
):
    """Override module's `__getattr__` to issue a deprecation errors when
    looking up attributes.

    This expects deprecated names to be prefixed with `DEP_` followed by their
    original pre-deprecation name.

    !!! example
        === "Before deprecation"
            ```python
            # issue module import warning:
            package_dep_warn()

            # define temporary implementations of to-be-deprecated attributes:
            something = ... actual working implementation or alias
            ```

        === "After deprecation"
            ```python
            # define deprecated attribute with None/any value but name with "DEP_"
            # prefix:
            DEP_something = None

            # issue module deprecation warning and override __getattr__ to issue
            # deprecation errors for the above:
            module_getattr_override()
            ```

    Also issues a deprecation warning for the module itself. This will be used
    in the next deprecation stage for throwing errors after deprecation errors.
    """

    if module is None:
        module = python_utils.caller_module_name(offset=1)  # skip our own frame

    mod = importlib.import_module(module)

    # Module deprecation warning.
    packages_dep_warn(module, message=message)

    def _getattr(name: str):
        if not hasattr(mod, "DEP_" + name):
            raise AttributeError(f"module {module} has no attribute {name}")

        # Issue a deprecation warning for the attribute including the
        # optional custom message as well if given.
        raise AttributeError(
            f"Attribute `{name}` has been deprecated in module `{module}`."
            + (" \n" + message if message else "")
        )

    mod.__getattr__ = _getattr
Override module's `__getattr__` to issue a deprecation errors when
    looking up attributes.

    This expects deprecated names to be prefixed with `DEP_` followed by their
    original pre-deprecation name.

    !!! example
        === "Before deprecation"
            ```python
            # issue module import warning:
            package_dep_warn()

            # define temporary implementations of to-be-deprecated attributes:
            something = ... actual working implementation or alias
            ```

        === "After deprecation"
            ```python
            # define deprecated attribute with None/any value but name with "DEP_"
            # prefix:
            DEP_something = None

            # issue module deprecation warning and override __getattr__ to issue
            # deprecation errors for the above:
            module_getattr_override()
            ```

    Also issues a deprecation warning for the module itself. This will be used
    in the next deprecation stage for throwing errors after deprecation errors.
    
src/core/trulens/core/utils/deprecation.py