code: def parse_error(
      status_code: int, payload: Dict[str, str]
  ) -> Exception:
      """
      Parse error given an HTTP status code and a json payload
  
      Args:
          status_code (`int`):
              HTTP status code
          payload (`Dict[str, str]`):
              Json payload
  
      Returns:
          Exception: parsed exception
  
      """
      # Try to parse a Text Generation Inference error
      message = payload["error"]
      if "error_type" in payload:
          error_type = payload["error_type"]
          if error_type == "generation":
              return GenerationError(message)
          if error_type == "incomplete_generation":
              return IncompleteGenerationError(message)
          if error_type == "overloaded":
              return OverloadedError(message)
          if error_type == "validation":
              return ValidationError(message)
  
      # Try to parse a APIInference error
      if status_code == 400:
          return BadRequestError(message)
      if status_code == 403 or status_code == 424:
          return ShardNotReadyError(message)
      if status_code == 504:
          return ShardTimeoutError(message)
      if status_code == 404:
          return NotFoundError(message)
      if status_code == 429:
          return RateLimitExceededError(message)
  
      # Fallback to an unknown error
      return UnknownError(message)
  
imports: from typing import Dict
label_desc: Use image node_id 1 for calling a global function with example usage: parse_error(status_code, payload) and returns: UnknownError, BadRequestError, ShardNotReadyError, ShardTimeoutError, NotFoundError, RateLimitExceededError, GenerationError, IncompleteGenerationError, OverloadedError, ValidationError