code: def _usage_endpoint(self, endpoint, year=None, month=None):
          
          err = False
          if year is None and month is None:
              resp = self.r_session.get(endpoint)
          else:
              try:
                  if int(year) > 0 and int(month) in range(1, 13):
                      resp = self.r_session.get(
                          '/'.join((endpoint, str(int(year)), str(int(month)))))
                  else:
                      err = True
              except (ValueError, TypeError):
                  err = True
  
          if err:
              raise CloudantArgumentError(101, year, month)
  
          resp.raise_for_status()
          return response_to_json_dict(resp)
docs: Common helper for getting usage and billing reports with
          optional year and month URL elements.
  
          :param str endpoint: Cloudant usage endpoint.
          :param int year: Year to query against.  Optional parameter.
              Defaults to None.  If used, it must be accompanied by ``month``.
          :param int month: Month to query against that must be an integer
              between 1 and 12. Optional parameter. Defaults to None.
              If used, it must be accompanied by ``year``.