docs: def wait_for_condition(obj, cond, timeout=None):
    """
    This is an extended version of #wait() that applies the function *cond* to
    check for a condition to break free from waiting on *obj*. Note that *obj*
    must be notified when its state changes in order to check the condition.
    Note that access to *obj* is synchronized when *cond* is called.
  
    # Arguments
    obj (Synchronizable): The object to synchronize and wait for *cond*.
    cond (function): A function that accepts *obj* as an argument. Must return
      #True if the condition is met.
    timeout (number, None): The maximum number of seconds to wait.
  
    # Returns
    bool: #True if the condition was met, #False if not and a timeout ocurred.
    """
  
    with synchronized(obj):
      if timeout is None:
        while not cond(obj):
          wait(obj)
      else:
        t_start = time.time()
        while not cond(obj):
          t_delta = time.time() - t_start
          if t_delta >= timeout:
            return False
          wait(obj, timeout - t_delta)
    return True