docs: def wait_for_interrupts(self, epoll_timeout=1):
          """
          Blocking loop to listen for GPIO interrupts and distribute them to
          associated callbacks. epoll_timeout is an easy way to shutdown the
          blocking function. Per default the timeout is set to 1 second; if
          `_is_waiting_for_interrupts` is set to False the loop will exit.
  
          If an exception occurs while waiting for interrupts, the interrupt
          gpio interfaces will be cleaned up (/sys/class/gpio unexports). In
          this case all interrupts will be reset and you'd need to add the
          callbacks again before using `wait_for_interrupts(..)` again.
          """
          self._is_waiting_for_interrupts = True
          while self._is_waiting_for_interrupts:
              events = self._epoll.poll(epoll_timeout)
              for fileno, event in events:
                  debug("- epoll event on fd %s: %s" % (fileno, event))
                  if fileno in self._tcp_server_sockets:
                      # New client connection to socket server
                      serversocket, cb = self._tcp_server_sockets[fileno]
                      connection, address = serversocket.accept()
                      connection.setblocking(0)
                      f = connection.fileno()
                      self._epoll.register(f, select.EPOLLIN)
                      self._tcp_client_sockets[f] = (connection, cb)
  
                  elif event & select.EPOLLIN:
                      # Input from TCP socket
                      socket, cb = self._tcp_client_sockets[fileno]
                      content = socket.recv(1024)
                      if not content or not content.strip():
                          # No content means quitting
                          self.close_tcp_client(fileno)
                      else:
                          sock, cb = self._tcp_client_sockets[fileno]
                          cb(self._tcp_client_sockets[fileno][0], \
                                  content.strip())
  
                  elif event & select.EPOLLHUP:
                      # TCP Socket Hangup
                      self.close_tcp_client(fileno)
  
                  elif event & select.EPOLLPRI:
                      # GPIO interrupts
                      f = self._map_fileno_to_file[fileno]
                      # read() is workaround for not getting new values
                      # with read(1)
                      val = f.read().strip()
                      f.seek(0)
                      self._handle_interrupt(fileno, val)