code: def _check_err(resp, url_suffix, data, allow_pagination):
          
          total_pages = resp.headers.get('x-total-pages')
          if not allow_pagination and total_pages:
              raise UnexpectedPagingReceivedError()
          if 200 <= resp.status_code < 300:
              return resp
          if resp.status_code == 404:
              if resp.json().get("code") == "resource_not_consistent":
                  raise DSResourceNotConsistentError(resp, url_suffix, data)
          raise DataServiceError(resp, url_suffix, data)
docs: Raise DataServiceError if the response wasn't successful.
          :param resp: requests.Response back from the request
          :param url_suffix: str url to include in an error message
          :param data: data payload we sent
          :param allow_pagination: when False and response headers contains 'x-total-pages' raises an error.
          :return: requests.Response containing the successful result