docs: def validate_count_api(rule_payload, endpoint):
      """
      Ensures that the counts api is set correctly in a payload.
      """
      rule = (rule_payload if isinstance(rule_payload, dict)
              else json.loads(rule_payload))
      bucket = rule.get('bucket')
      counts = set(endpoint.split("/")) & {"counts.json"}
      if len(counts) == 0:
          if bucket is not None:
              msg = ("""There is a count bucket present in your payload,
                     but you are using not using the counts API.
                     Please check your endpoints and try again""")
              logger.error(msg)
              raise ValueError