def python_exec(code: str) -> str:
        """
        Execute the provided Python code and return the output.
        """
        import sys
        from io import StringIO

        sys_stdout = sys.stdout
        redirected_output = StringIO()
        sys.stdout = redirected_output

        exec(code)
        sys.stdout = sys_stdout
        return redirected_output.getvalue()

        Execute the provided Python code and return the output.
        
ai/core/tests/core/databricks/test_databricks_integration_tests.py