code: def wait(self, condition_or_value, timeout=None):
          if (isinstance(condition_or_value, collections.Sequence) and not
                  isinstance(condition_or_value, basestring)):
              raise NotImplementedError(
                  'Currently only single conditions are supported')
          condition_test = (condition_or_value if callable(condition_or_value)
                            else lambda s: s.value == condition_or_value)
          ioloop = tornado.ioloop.IOLoop.current()
          f = Future()
          if self.sampling_strategy == ('none', ):
              raise KATCPSensorError(
                  'Cannot wait on a sensor that does not have a strategy set')
          def handle_update(sensor, reading):
              try:
                  assert sensor is self
                  if condition_test(reading):
                      self.unregister_listener(handle_update)
                      if not f.done():
                          ioloop.add_callback(f.set_result, True)
              except Exception:
                  f.set_exc_info(sys.exc_info())
                  self.unregister_listener(handle_update)
          self.register_listener(handle_update, reading=True)
          ioloop.add_callback(handle_update, self, self._reading)
          if timeout:
              to = ioloop.time() + timeout
              timeout_f = with_timeout(to, f)
              timeout_f.add_done_callback(
                  lambda f: self.unregister_listener(handle_update))
              return timeout_f
          else:
              return f