def get_or_create_workspace(
    config_path="./.azureml",
    subscription_id=None,
    resource_group=None,
    workspace_name=None,
    workspace_region=None,
):
    """
    Method to get or create workspace.

    Args:
        config_path: optional directory to look for / store config.json file (defaults to current
            directory)
        subscription_id: Azure subscription id
        resource_group: Azure resource group to create workspace and related resources
        workspace_name: name of azure ml workspace
        workspace_region: region for workspace

    Returns:
        obj: AzureML workspace if one exists already with the name otherwise creates a new one.
    """
    config_file_path = "."

    if config_path is not None:
        config_dir, config_file_name = os.path.split(config_path)
        if config_file_name != "config.json":
            config_file_path = os.path.join(config_path, "config.json")

    try:
        # get existing azure ml workspace
        if os.path.isfile(config_file_path):
            ws = Workspace.from_config(config_file_path, auth=get_auth())
        else:
            ws = Workspace.get(
                name=workspace_name,
                subscription_id=subscription_id,
                resource_group=resource_group,
                auth=get_auth(),
            )

    except ProjectSystemException:
        # this call might take a minute or two.
        print("Creating new workspace")
        ws = Workspace.create(
            name=workspace_name,
            subscription_id=subscription_id,
            resource_group=resource_group,
            create_resource_group=True,
            location=workspace_region,
            auth=get_auth(),
        )

        ws.write_config(path=config_path)
    return ws

    Method to get or create workspace.

    Args:
        config_path: optional directory to look for / store config.json file (defaults to current
            directory)
        subscription_id: Azure subscription id
        resource_group: Azure resource group to create workspace and related resources
        workspace_name: name of azure ml workspace
        workspace_region: region for workspace

    Returns:
        obj: AzureML workspace if one exists already with the name otherwise creates a new one.
    
utils_nlp/azureml/azureml_utils.py