def wait_until_pause_is_applied(dcs: AbstractDCS, paused: bool, old_cluster: Cluster) -> None:
    """Wait for all members in the cluster to have ``pause`` state set to *paused*.

    :param dcs: DCS object from where to get fresh cluster information.
    :param paused: the desired state for ``pause`` in all nodes.
    :param old_cluster: original cluster information before pause or unpause has been requested. Used to report which
        nodes are still pending to have ``pause`` equal *paused* at a given point in time.
    """
    config = global_config.from_cluster(old_cluster)

    click.echo("'{0}' request sent, waiting until it is recognized by all nodes".format(paused and 'pause' or 'resume'))
    old = {m.name: m.version for m in old_cluster.members if m.api_url}
    loop_wait = config.get('loop_wait') or dcs.loop_wait

    cluster = None
    for _ in polling_loop(loop_wait + 1):
        cluster = dcs.get_cluster()
        if all(m.data.get('pause', False) == paused for m in cluster.members if m.name in old):
            break
    else:
        if TYPE_CHECKING:  # pragma: no cover
            assert cluster is not None
        remaining = [m.name for m in cluster.members if m.data.get('pause', False) != paused
                     and m.name in old and old[m.name] != m.version]
        if remaining:
            return click.echo("{0} members didn't recognized pause state after {1} seconds"
                              .format(', '.join(remaining), loop_wait))
    return click.echo('Success: cluster management is {0}'.format(paused and 'paused' or 'resumed'))
Wait for all members in the cluster to have ``pause`` state set to *paused*.

    :param dcs: DCS object from where to get fresh cluster information.
    :param paused: the desired state for ``pause`` in all nodes.
    :param old_cluster: original cluster information before pause or unpause has been requested. Used to report which
        nodes are still pending to have ``pause`` equal *paused* at a given point in time.
    
patroni/ctl.py