code: def get_or_create_user(get_user, create_user) -> ab_models.User:
      @contextlib.contextmanager
      def _get_user(username: str) -> ab_models.User:
          user = get_user(username)
          if not user:
              # if user is created by test, remove it after done
              user = create_user(username)
              yield user
              db.session.delete(user)
          else:
              yield user
  
      return _get_user
  
imports: from __future__ import annotations
  import contextlib
  import functools
  import os
  from typing import Any, Callable, TYPE_CHECKING
  from unittest.mock import patch
  import pytest
  from flask.ctx import AppContext
  from flask_appbuilder.security.sqla import models
  from sqlalchemy.engine import Engine
  from superset import db, security_manager
  from superset.extensions import feature_flag_manager
  from superset.utils.core import json_dumps_w_dates
  from superset.utils.database import get_example_database, remove_database
  from tests.integration_tests.test_app import app, login
label_desc: Use image node_id 7 for calling a global function with example usage: get_or_create_user(get_user, create_user) and returns: _get_user