def get_any_member(cluster: Cluster, group: Optional[int],
                   role: Optional[CtlPostgresqlRole] = None, member: Optional[str] = None) -> Optional[Member]:
    """Get the first found cluster member that has the given *role*.

    :param cluster: the Patroni cluster.
    :param group: filter which Citus group we should get members from. If ``None`` get from all groups.
    :param role: role to filter members. See :func:`get_all_members` for available options.
    :param member: if specified, then besides having the given *role*, the cluster member's name should be *member*.

    :returns: the first found cluster member that has the given *role*.

    :raises:
        :class:`PatroniCtlException`: if both *role* and *member* are provided.
    """
    if member is not None:
        if role is not None:
            raise PatroniCtlException('--role and --member are mutually exclusive options')
        role = CtlPostgresqlRole.ANY
    elif role is None:
        role = CtlPostgresqlRole.LEADER

    for m in get_all_members(cluster, group, role):
        if member is None or m.name == member:
            return m
Get the first found cluster member that has the given *role*.

    :param cluster: the Patroni cluster.
    :param group: filter which Citus group we should get members from. If ``None`` get from all groups.
    :param role: role to filter members. See :func:`get_all_members` for available options.
    :param member: if specified, then besides having the given *role*, the cluster member's name should be *member*.

    :returns: the first found cluster member that has the given *role*.

    :raises:
        :class:`PatroniCtlException`: if both *role* and *member* are provided.
    
patroni/ctl.py