code: def clear_socket(self):
          '''
          delete socket if you have it
          '''
          if hasattr(self, '_socket'):
              if isinstance(self.poller.sockets, dict):
                  sockets = list(self.poller.sockets.keys())
                  for socket in sockets:
                      log.trace('Unregistering socket: %s', socket)
                      self.poller.unregister(socket)
              else:
                  for socket in self.poller.sockets:
                      log.trace('Unregistering socket: %s', socket)
                      self.poller.unregister(socket[0])
              del self._sockef clear_socket(self):
          '''
          delete socket if you have it
          '''
          if hasattr(self, '_socket'):
              if isinstance(self.poller.sockets, dict):
                  sockets = list(self.poller.sockets.keys())
                  for socket in sockets:
                      log.trace('Unregistering socket: %s', socket)
                      self.poller.unregister(socket)
              else:
                  for socket in self.poller.sockets:
                      log.trace('Unregistering socket: %s', socket)
                      self.poller.unregister(socket[0])
              del self._socket
docs: delete socket if you have it