code: def _wait_receive_msg(self, timeout=0.25, type=2):
          
          stamp = time.monotonic()
          while (time.monotonic() - stamp) < timeout:
              try:
                  message = self._mq.receive(block=False, type=2)
                  return message
              except sysv_ipc.BusyError:
                  time.sleep(0.001) # wait a bit then retry!
          # uh-oh timed out
          raise RuntimeError("Timed out waiting for PulseIn message")
docs: Internal helper that will wait for new messages of a given type,
          and throw an exception on timeout