def wait(obj, timeout=None):
  """
  Wait until *obj* gets notified with #notify() or #notify_all(). If a timeout
  is specified, the function can return without the object being notified if
  the time runs out.

  Note that you can only use this function on #synchronized() objects.

  # Arguments
  obj (Synchronizable): An object that can be synchronized.
  timeout (number, None): The number of seconds to wait for the object to get
    notified before returning. If not value or the value #None is specified,
    the function will wait indefinetily.
  """

  if timeout is None:
    return obj.synchronizable_condition.wait()
  else:
    return obj.synchronizable_condition.wait(timeout)