code: def get_mock_client(root_client, role) -> DomainClient:
      worker = root_client.api.connection.node
      client = worker.guest_client
      mail = Faker().email()
      name = Faker().name()
      password = "pw"
      user = root_client.register(
          name=name,
          email=mail,
          password=password,
          password_verify=password,
      )
      assert user
      user_id = [u for u in get_users(worker) if u.email == mail][0].id
      assert worker.root_client.api.services.user.update(
          user_id, UserUpdate(user_id=user_id, role=role)
      )
      client = client.login(email=mail, password=password)
      client._fetch_api(client.credentials)
      # hacky, but useful for testing: patch user id and role on client
      client.user_id = user_id
      client.role = role
      return client
  
imports: from faker import Faker
  import pytest
  import syft
  from syft import SyftError
  from syft import SyftSuccess
  from syft.client.api import SyftAPICall
  from syft.client.domain_client import DomainClient
  from syft.node.node import get_default_root_email
  from syft.node.worker import Worker
  from syft.service.context import AuthedServiceContext
  from syft.service.user.user import ServiceRole
  from syft.service.user.user import UserCreate
  from syft.service.user.user import UserUpdate
  from syft.service.user.user import UserView
label_desc: Use image node_id 2 for calling a global function with example usage: get_mock_client(root_client, role) and returns: client