code: def select(sockets, remain=None):
          
          blocking = remain is None or remain > 0
  
          def find_ready_sockets():
              return list(filter(lambda x: not x.ins.rx_queue.empty(), sockets))
  
          ready_sockets = find_ready_sockets()
          if len(ready_sockets) > 0 or not blocking:
              return ready_sockets, None
  
          exit_select = Event()
  
          def my_cb(msg):
              exit_select.set()
  
          try:
              for s in sockets:
                  s.ins.rx_callbacks.append(my_cb)
  
              exit_select.wait(remain)
  
          finally:
              for s in sockets:
                  try:
                      s.ins.rx_callbacks.remove(my_cb)
                  except ValueError:
                      pass
  
          ready_sockets = find_ready_sockets()
          return ready_sockets, None
docs: This function is called during sendrecv() routine to wait for
          sockets to be ready to receive