code: async def _pinger(self):
          '''
          A Controller can time us out if we are silent for too long. This
          is especially true in JaaS, which has a fairly strict timeout.
  
          To prevent timing out, we send a ping every ten seconds.
  
          '''
          async def _do_ping():
              try:
                  await pinger_facade.Ping()
                  await asyncio.sleep(10, loop=self.loop)
              except CancelledError:
                  pass
  
          pinger_facade = client.PingerFacade.from_connection(self)
          try:
              while True:
                  await utils.run_with_interrupt(
                      _do_ping(),
                      self.monitor.close_called,
                      loop=self.loop)
                  if self.monitor.close_called.is_set():
                      break
          except websockets.exceptions.ConnectionClosed:
              # The connection has closed - we can't do anything
              # more until the connection is restarted.
              log.debug('ping failed because of closed connection')
              pasync def _pinger(self):
          '''
          A Controller can time us out if we are silent for too long. This
          is especially true in JaaS, which has a fairly strict timeout.
  
          To prevent timing out, we send a ping every ten seconds.
  
          '''
          async def _do_ping():
              try:
                  await pinger_facade.Ping()
                  await asyncio.sleep(10, loop=self.loop)
              except CancelledError:
                  pass
  
          pinger_facade = client.PingerFacade.from_connection(self)
          try:
              while True:
                  await utils.run_with_interrupt(
                      _do_ping(),
                      self.monitor.close_called,
                      loop=self.loop)
                  if self.monitor.close_called.is_set():
                      break
          except websockets.exceptions.ConnectionClosed:
              # The connection has closed - we can't do anything
              # more until the connection is restarted.
              log.debug('ping failed because of closed connection')
              pass
docs: A Controller can time us out if we are silent for too long. This
          is especially true in JaaS, which has a fairly strict timeout.
  
          To prevent timing out, we send a ping every ten seconds.