code: def wait_for_property(self, name, cond=lambda val: val, level_sensitive=True):
          
          sema = threading.Semaphore(value=0)
          def observer(name, val):
              if cond(val):
                  sema.release()
          self.observe_property(name, observer)
          if not level_sensitive or not cond(getattr(self, name.replace('-', '_'))):
              sema.acquire()
          self.unobserve_property(name, observer)
docs: Waits until ``cond`` evaluates to a truthy value on the named property. This can be used to wait for
          properties such as ``idle_active`` indicating the player is done with regular playback and just idling around