code: def build_typed_response(
      response: httpx.Response,
      response_type_class: Optional[Type[ResponseType]] = None,
  ) -> Response[Union[ResponseType, ErrorMessage, HTTPValidationError]]:
      parsed_response = check_response(
          response, expected_response=response_type_class
      )
      if response_type_class:
          parsed_response = response_type_class(**parsed_response)
      return Response(
          status_code=response.status_code,
          content=response.content,
          headers=response.headers,
          parsed=parsed_response,
      )
  
file_path: argilla/src/argilla/client/sdk/_helpers.py
imports: from json import JSONDecodeError
  from typing import Any, Dict, Optional, Type, TypeVar, Union
  import httpx
  from argilla.client.sdk.commons.errors import WrongResponseError
  from argilla.client.sdk.commons.errors_handler import handle_response_error
  from argilla.client.sdk.commons.models import ErrorMessage, HTTPValidationError, Response
label_desc: Use image node_id 2 for calling a global function with example usage: build_typed_response(response, response_type_class) and returns: Response