code: def create_test_user(
      add_password: bool = False,
      session: Optional[api.Session] = None,
      user: Optional[bindings.v1User] = None,
  ) -> authentication.Credentials:
      session = session or determined_test_session(admin=True)
      user = user or bindings.v1User(
          username=get_random_string(), admin=False, active=True
      )
      password = get_random_string() if add_password else ""
      bindings.post_PostUser(
          session,
          body=bindings.v1PostUserRequest(user=user, password=password),
      )
      return authentication.Credentials(user.username, password)
  
imports: import uuid
  from typing import Callable, Optional, Sequence, TypeVar
  import pytest
  from determined.common import api
  from determined.common.api import authentication, bindings, certs, errors
  from tests import config
label_desc: Use image node_id 3 for calling a global function with example usage: create_test_user(add_password, session, user) and returns: authentication