def wait_for_single_device(self, timeout=None, interval=0.5):
    """
    Waits until a Myo is was paired **and** connected with the Hub and returns
    it. If the *timeout* is exceeded, returns None. This function will not
    return a Myo that is only paired but not connected.

    # Parameters
    timeout: The maximum time to wait for a device.
    interval: The interval at which the function should exit sleeping. We can
      not sleep endlessly, otherwise the main thread can not be exit, eg.
      through a KeyboardInterrupt.
    """

    timer = TimeoutManager(timeout)
    with self._cond:
      # As long as there are no Myo's connected, wait until we
      # get notified about a change.
      while not timer.check():
        # Check if we found a Myo that is connected.
        for device in self._devices.values():
          if device.connected:
            return device
        self._cond.wait(timer.remainder(interval))

    return None