text: # -*- coding: utf-8 -*-
  
  """
  bandwidth
  
  This file was automatically generated by APIMATIC v3.0 (
   https://www.apimatic.io ).
  """
  
  from bandwidth.api_helper import APIHelper
  from bandwidth.configuration import Server
  from bandwidth.http.api_response import ApiResponse
  from bandwidth.phonenumberlookup.controllers.base_controller import BaseController
  from bandwidth.http.auth.phone_number_lookup_basic_auth import PhoneNumberLookupBasicAuth
  from bandwidth.phonenumberlookup.models.order_response import OrderResponse
  from bandwidth.phonenumberlookup.models.order_status import OrderStatus
  from bandwidth.phonenumberlookup.exceptions.accounts_tnlookup_400_error_exception import AccountsTnlookup400ErrorException
  from bandwidth.exceptions.api_exception import APIException
  
  
  class APIController(BaseController):
  
      """A Controller to access Endpoints in the bandwidth API."""
  
      def __init__(self, config, call_back=None):
          super(APIController, self).__init__(config, call_back)
  
      def create_lookup_request(self,
                                account_id,
                                body):
          """Does a POST request to /accounts/{accountId}/tnlookup.
  
          Create a TN Lookup Order.
  
          Args:
              account_id (string): The ID of the Bandwidth account that the user
                  belongs to.
              body (OrderRequest): TODO: type description here.
  
          Returns:
              ApiResponse: An object with the response value as well as other
                  useful information such as status codes and headers. The
                  request has been accepted for processing but not yet finished
                  and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or
                  FAILED)
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/accounts/{accountId}/tnlookup'
          _url_path = APIHelper.append_url_with_template_parameters(_url_path, {
              'accountId': {'value': account_id, 'encode': False}
          })
          _query_builder = self.config.get_base_uri(Server.PHONENUMBERLOOKUPDEFAULT)
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json',
              'content-type': 'application/json; charset=utf-8'
          }
  
          # Prepare and execute request
          _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
          PhoneNumberLookupBasicAuth.apply(self.config, _request)
          _response = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _response.status_code == 400:
              raise AccountsTnlookup400ErrorException('Bad Request. Ensure that your request payload is properly formatted and that the telephone numbers used are valid.', _response)
          elif _response.status_code == 401:
              raise APIException('Unauthorized. Ensure that you are using the proper credentials for the environment you are accessing, your user has the proper role assigned to it, and that your Bandwidth account is enabled for TN Lookup access.', _response)
          elif _response.status_code == 415:
              raise APIException('Invalid content-type. Ensure that your content-type header is set to application/json.', _response)
          elif _response.status_code == 429:
              raise APIException('Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving this status code.', _response)
          elif _response.status_code == 500:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 501:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 502:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 503:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 504:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 505:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 506:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 507:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 508:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 509:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 510:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 511:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 512:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 513:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 514:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 515:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 516:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 517:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 518:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 519:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 520:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 521:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 522:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 523:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 524:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 525:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 526:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 527:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 528:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 529:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 530:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 531:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 532:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 533:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 534:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 535:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 536:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 537:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 538:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 539:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 540:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 541:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 542:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 543:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 544:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 545:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 546:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 547:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 548:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 549:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 550:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 551:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 552:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 553:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 554:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 555:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 556:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 557:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 558:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 559:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 560:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 561:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 562:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 563:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 564:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 565:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 566:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 567:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 568:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 569:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 570:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 571:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 572:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 573:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 574:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 575:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 576:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 577:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 578:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 579:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 580:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 581:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 582:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 583:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 584:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 585:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 586:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 587:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 588:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 589:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 590:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 591:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 592:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 593:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 594:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 595:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 596:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 597:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 598:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 599:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          self.validate_response(_response)
  
          decoded = APIHelper.json_deserialize(_response.text, OrderResponse.from_dictionary)
          _result = ApiResponse(_response, body=decoded)
          return _result
  
      def get_lookup_request_status(self,
                                    account_id,
                                    request_id):
          """Does a GET request to /accounts/{accountId}/tnlookup/{requestId}.
  
          Query an existing TN Lookup Order.
  
          Args:
              account_id (string): The ID of the Bandwidth account that the user
                  belongs to.
              request_id (string): TODO: type description here.
  
          Returns:
              ApiResponse: An object with the response value as well as other
                  useful information such as status codes and headers. If
                  requestId exists, the result for that request is returned. See
                  the Examples for details on the various responses that you can
                  receive.  Generally, if you see a Response Code of 0 in a
                  result for a TN, information will be available for it.  Any
                  other Response Code will indicate no information was available
                  for the TN.
  
          Raises:
              APIException: When an error occurs while fetching the data from
                  the remote API. This exception includes the HTTP Response
                  code, an error message, and the HTTP body that was received in
                  the request.
  
          """
  
          # Prepare query URL
          _url_path = '/accounts/{accountId}/tnlookup/{requestId}'
          _url_path = APIHelper.append_url_with_template_parameters(_url_path, {
              'accountId': {'value': account_id, 'encode': False},
              'requestId': {'value': request_id, 'encode': False}
          })
          _query_builder = self.config.get_base_uri(Server.PHONENUMBERLOOKUPDEFAULT)
          _query_builder += _url_path
          _query_url = APIHelper.clean_url(_query_builder)
  
          # Prepare headers
          _headers = {
              'accept': 'application/json'
          }
  
          # Prepare and execute request
          _request = self.config.http_client.get(_query_url, headers=_headers)
          PhoneNumberLookupBasicAuth.apply(self.config, _request)
          _response = self.execute_request(_request)
  
          # Endpoint and global error handling using HTTP status codes.
          if _response.status_code == 400:
              raise APIException('Bad Request. Ensure that you have set the requestId as a URL path parameter.', _response)
          elif _response.status_code == 401:
              raise APIException('Unauthorized. Ensure that you are using the proper credentials for the environment you are accessing, your user has the proper role assigned to it, and that your Bandwidth account is enabled for TN Lookup access.', _response)
          elif _response.status_code == 404:
              raise APIException('RequestId not found. Ensure that the requestId used in the URL path is valid and maps to a previous request that was submitted.', _response)
          elif _response.status_code == 429:
              raise APIException('Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving this status code.', _response)
          elif _response.status_code == 500:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 501:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 502:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 503:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 504:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 505:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 506:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 507:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 508:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 509:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 510:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 511:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 512:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 513:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 514:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 515:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 516:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 517:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 518:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 519:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 520:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 521:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 522:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 523:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 524:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 525:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 526:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 527:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 528:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 529:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 530:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 531:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 532:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 533:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 534:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 535:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 536:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 537:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 538:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 539:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 540:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 541:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 542:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 543:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 544:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 545:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 546:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 547:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 548:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 549:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 550:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 551:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 552:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 553:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 554:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 555:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 556:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 557:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 558:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 559:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 560:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 561:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 562:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 563:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 564:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 565:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 566:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 567:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 568:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 569:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 570:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 571:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 572:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 573:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 574:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 575:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 576:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 577:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 578:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 579:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 580:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 581:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 582:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 583:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 584:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 585:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 586:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 587:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 588:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 589:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 590:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 591:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 592:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 593:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 594:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 595:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 596:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 597:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 598:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          elif _response.status_code == 599:
              raise APIException('Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.', _response)
          self.validate_response(_response)
  
          decoded = APIHelper.json_deserialize(_response.text, OrderStatus.from_dictionary)
          _result = ApiResponse(_response, body=decoded)
          return _result
  