def ensure_dcs_access(self, sleep_time: int = 5) -> 'Cluster':
        """Continuously attempt to retrieve cluster from DCS with delay.

        :param sleep_time: seconds to wait between retry attempts after dcs connection raise :exc:`DCSError`.

        :returns: a PostgreSQL or MPP implementation of :class:`Cluster`.
        """
        from patroni.exceptions import DCSError

        while True:
            try:
                return self.dcs.get_cluster()
            except DCSError:
                logger.warning('Can not get cluster from dcs')
                time.sleep(sleep_time)
Continuously attempt to retrieve cluster from DCS with delay.

        :param sleep_time: seconds to wait between retry attempts after dcs connection raise :exc:`DCSError`.

        :returns: a PostgreSQL or MPP implementation of :class:`Cluster`.
        
patroni/__main__.py