def METHOD_NAME(client, kind, name, namespace):
    v1 = client.CoreV1Api()
    if kind.lower() in ["endpoints", "endpoint", "ep"]:
        obj = v1.read_namespaced_endpoints(name, namespace, _request_timeout=K8S_REQUEST_TIMEOUT)
    elif kind.lower() in ["configmap", "cm"]:
        obj = v1.read_namespaced_config_map(name, namespace, _request_timeout=K8S_REQUEST_TIMEOUT)
    else:
        raise ValueError("Unknown kind {}".format(kind))
    if not obj:
        raise ValueError("Empty input object")
    try:
        annotations = obj.metadata.annotations
    except AttributeError:
        raise ValueError("Invalid input object type")
    for name in ELECTION_ANNOTATION_NAMES:
        if name in annotations:
            return ElectionRecordAnnotation(kind, annotations[name])
    # Could not find annotation
    raise ValueError("Object has no leader election annotation")