code: def error_wrapper(error, errorClass):
      
      http_status = 0
      if error.check(TwistedWebError):
          xml_payload = error.value.response
          if error.value.status:
              http_status = int(error.value.status)
      else:
          error.raiseException()
      if http_status >= 400:
          if not xml_payload:
              error.raiseException()
          try:
              fallback_error = errorClass(
                  xml_payload, error.value.status, str(error.value),
                  error.value.response)
          except (ParseError, AWSResponseParseError):
              error_message = http.RESPONSES.get(http_status)
              fallback_error = TwistedWebError(
                  http_status, error_message, error.value.response)
          raise fallback_error
      elif 200 <= http_status < 300:
          return str(error.value)
      else:
          error.raiseException()
docs: We want to see all error messages from cloud services. Amazon's EC2 says
      that their errors are accompanied either by a 400-series or 500-series HTTP
      response code. As such, the first thing we want to do is check to see if
      the error is in that range. If it is, we then need to see if the error
      message is an EC2 one.
  
      In the event that an error is not a Twisted web error nor an EC2 one, the
      original exception is raised.