def __enter__(self):
        """Handle entering the WithOptionalImports context block.

        We override the builtins.__import__ function to catch any import errors.
        """

        # TODO: Better handle nested contexts. For now we don't override import
        # and just let the already-overridden one do its thing.

        if "trulens" in str(builtins.__import__):
            logger.debug(
                "Nested optional imports context used. This context will be ignored."
            )
        else:
            builtins.__import__ = self.__import__

        self.importing = True

        return self
Handle entering the WithOptionalImports context block.

        We override the builtins.__import__ function to catch any import errors.
        
src/core/trulens/core/utils/imports.py