code: def _check(self):
          '''Check and close connection if needed.'''
          _logger.debug('Check if timeout.')
          self._call_later_handle = None
  
          if self._touch_time is not None:
              difference = self._event_loop.time() - self._touch_time
              _logger.debug('Time difference %s', difference)
  
              if difference > self._timeout:
                  self._connection.close()
                  self._timed_out = True
  
          if not self._connection.closed():
              self._schedule(f _check(self):
          '''Check and close connection if needed.'''
          _logger.debug('Check if timeout.')
          self._call_later_handle = None
  
          if self._touch_time is not None:
              difference = self._event_loop.time() - self._touch_time
              _logger.debug('Time difference %s', difference)
  
              if difference > self._timeout:
                  self._connection.close()
                  self._timed_out = True
  
          if not self._connection.closed():
              self._schedule()
docs: Check and close connection if needed.