code: def check_election_status(self, config):
          
          try:
              record = self._get_record(
                  config.get("record_kind", ""), config.get("record_name", ""), config.get("record_namespace", "")
              )
              self._report_status(config, record)
          except Exception as e:
              self.warning("Cannot retrieve leader election record {}: {}".format(config.get("record_name", ""), e))
docs: Retrieves the leader-election annotation from a given object, and
          submits metrics and a service check.
  
          An integration warning is sent if the object is not retrievable,
          or no record is found. Monitors on the service-check should have
          no-data alerts enabled to account for this.
  
          The config objet requires the following fields:
              namespace (prefix for the metrics and check)
              record_kind (endpoints or configmap)
              record_name
              record_namespace
              tags (optional)
  
          It reads the following agent configuration:
              kubernetes_kubeconfig_path: defaut is to use in-cluster config