code: def get_etcd_leader(release_name, deploy_tool="helm"):
      """get etcd leader by etcdctl"""
      pod_list = []
      if deploy_tool == "helm":
          label_selector = f"app.kubernetes.io/instance={release_name}-etcd, app.kubernetes.io/name=etcd"
          pod_list = get_pod_list("chaos-testing", label_selector)
          if len(pod_list) == 0:
              label_selector = f"app.kubernetes.io/instance={release_name}, app.kubernetes.io/name=etcd"
              pod_list = get_pod_list("chaos-testing", label_selector)
      if deploy_tool == "operator":
          label_selector = f"app.kubernetes.io/instance={release_name}, app.kubernetes.io/name=etcd"
          pod_list = get_pod_list("chaos-testing", label_selector)
      leader = None
      for pod in pod_list:
          endpoint = f"{pod.status.pod_ip}:2379"
          cmd = (
              f"etcdctl --endpoints={endpoint} endpoint status -w table"
          )
          output = os.popen(cmd).read()
          log.info(f"etcdctl output: {output}")
          title, data = parse_etcdctl_table_output(output)
          idx = title.index("IS LEADER")
          if data[0][idx] == "true":
              leader = pod.metadata.name
      log.info(f"etcd leader is {leader}")
      return leader
  
imports: import json
  import os.path
  import time
  import pyetcd
  import requests
  from pymilvus import connections
  from kubernetes import client, config
  from kubernetes.client.rest import ApiException
  from common.milvus_sys import MilvusSys
  from utils.util_log import test_log
  from chaos import chaos_commons
  from common.common_type import in_cluster_env
label_desc: Use image node_id 14 for calling a global function with example usage: get_etcd_leader(release_name, deploy_tool) and returns: leader