@classmethod
    def get_user_workspace(cls, user):
        username = ''

        from django.contrib.auth.models import User
        if isinstance(user, User) or isinstance(user, SimpleLazyObject):
            username = user.username
        elif isinstance(user, HttpRequest):
            username = user.user.username
        elif user is None:
            pass
        else:
            raise ValueError("Invalid type for argument 'user': must be either an User or HttpRequest object.")

        if not username:
            username = 'anonymous_user'

        project_directory = os.path.dirname(sys.modules[cls.__module__].__file__)
        workspace_directory = os.path.join(project_directory, 'workspaces', 'user_workspaces', username)
        return TethysWorkspace(workspace_directory)
Ensure errors are not thrown when using non-default policies
dataset/ETHPy150Open tethysplatform/tethys/tethys_apps/base/app_base.py/TethysAppBase.get_user_workspace--crossover with--dataset/ETHPy150Open datastax/python-driver/tests/integration/standard/test_cluster.py/ClusterTests.test_default_connections