code: async def setup(self):
          
          while True:
              fut = self.loop.create_connection(
                  lambda: SW16Protocol(
                      self,
                      disconnect_callback=self.handle_disconnect_callback,
                      loop=self.loop, logger=self.logger),
                  host=self.host,
                  port=self.port)
              try:
                  self.transport, self.protocol = \
                      await asyncio.wait_for(fut, timeout=self.timeout)
              except asyncio.TimeoutError:
                  self.logger.warning("Could not connect due to timeout error.")
              except OSError as exc:
                  self.logger.warning("Could not connect due to error: %s",
                                      str(exc))
              else:
                  self.is_connected = True
                  if self.reconnect_callback:
                      self.reconnect_callback()
                  break
              await asyncio.sleep(self.reconnect_interval)
docs: Set up the connection with automatic retry.