code: def mock_node_resp_exc(
      node: ClusterNode, exc: Exception
  ) -> ClusterNode:
      connection = mock.AsyncMock(spec=Connection)
      connection.is_connected = True
      connection.read_response.side_effect = exc
      connection._get_from_local_cache.return_value = None
      while node._free:
          node._free.pop()
      node._free.append(connection)
      return node
  
imports: import asyncio
  import binascii
  import datetime
  import warnings
  from typing import Any, Awaitable, Callable, Dict, List, Optional, Type, Union
  from urllib.parse import urlparse
  import pytest
  import pytest_asyncio
  from _pytest.fixtures import FixtureRequest
  from redis._parsers import AsyncCommandsParser
  from redis.asyncio.cluster import ClusterNode, NodesManager, RedisCluster
  from redis.asyncio.connection import Connection, SSLConnection, async_timeout
  from redis.asyncio.retry import Retry
  from redis.backoff import ExponentialBackoff, NoBackoff, default_backoff
  from redis.cluster import PIPELINE_BLOCKED_COMMANDS, PRIMARY, REPLICA, get_node_name
  from redis.crc import REDIS_CLUSTER_HASH_SLOTS, key_slot
  from redis.exceptions import AskError, ClusterDownError, ConnectionError, DataError, MaxConnectionsError, MovedError, NoPermissionError, RedisClusterException, RedisError, ResponseError
  from redis.utils import str_if_bytes
  from tests.conftest import assert_resp_response, is_resp2_connection, skip_if_redis_enterprise, skip_if_server_version_gte, skip_if_server_version_lt, skip_unless_arch_bits
  from ..ssl_utils import get_ssl_filename
  from .compat import aclosing, mock
label_desc: Use image node_id 2 for calling a global function with example usage: mock_node_resp_exc(node, exc) and returns: node