def METHOD_NAME(kind, name, namespace):
    global client, config
    if client is config is None:
        from kubernetes import client, config  # noqa F401
    kubeconfig_path = datadog_agent.get_config('kubernetes_kubeconfig_path')
    if kubeconfig_path:
        config.load_kube_config(config_file=kubeconfig_path)
    else:
        config.load_incluster_config()
    if kind.lower() == "auto":
        # Try lease object
        try:
            return KubeLeaderElectionMixin._get_record_from_lease(client, name, namespace)
        except client.exceptions.ApiException:
            pass
        # Default to endpoints object
        return KubeLeaderElectionMixin._get_record_from_annotation(client, "endpoints", name, namespace)
    elif kind.lower() in ["leases", "lease"]:
        return KubeLeaderElectionMixin._get_record_from_lease(client, name, namespace)
    else:
        return KubeLeaderElectionMixin._get_record_from_annotation(client, kind, name, namespace)