parameters: (container: AnyContainer)
docstring: Make sure that the given argument is a :class:`.Window`.
docstring_summary: Make sure that the given argument is a :class:`.Window`.
docstring_tokens: Make sure that the given argument is a : class : . Window .
function: def to_window(container: AnyContainer) -> Window:
      """
      Make sure that the given argument is a :class:`.Window`.
      """
      if isinstance(container, Window):
          return container
      elif hasattr(container, "__pt_container__"):
          return to_window(cast("MagicContainer", container).__pt_container__())
      else:
          raise ValueError("Not a Window object: %r." % (container,))
function_tokens: def to_window ( container : AnyContainer ) -> Window : if isinstance ( container , Window ) : return container elif hasattr ( container , "__pt_container__" ) : return to_window ( cast ( "MagicContainer" , container ) . __pt_container__ ( ) ) else : raise ValueError ( "Not a Window object: %r." % ( container , ) )