code: def check_status_code(response, codes=None):
      
      codes = codes or [httplib.OK]
      checker = (
          codes
          if callable(codes)
          else lambda resp: resp.status_code in codes
      )
      if not checker(response):
          raise exceptions.ApiError(response, response.json())
docs: Check HTTP status code and raise exception if incorrect.
  
      :param Response response: HTTP response
      :param codes: List of accepted codes or callable
      :raises: ApiError if code invalid