class_docstr: The layout for a prompt_toolkit
  :class:`~prompt_toolkit.application.Application`.
  This also keeps track of which user control is focused.
  
  :param container: The "root" container for the layout.
  :param focused_element: element to be focused initially. (Can be anything
      the `focus` function accepts.)
class_docstr_tok: ["The","layout","for","a","prompt_toolkit",":","class",":","`","~prompt_toolkit.application.Application","`",".","This","also","keeps","track","of","which","user","control","is","focused",".",":","param","container",":","The","``","root","''","container","for","the","layout",".",":","param","focused_element",":","element","to","be","focused","initially",".","(","Can","be","anything","the","`","focus","`","function","accepts",".",")"]
docstr: Check whether the given control has the focus.
  :param value: :class:`.UIControl` or :class:`.Window` instance.
docstr_tok: ["Check","whether","the","given","control","has","the","focus",".",":","param","value",":",":","class",":","`",".UIControl","`","or",":","class",":","`",".Window","`","instance","."]
code: def has_focus(self, value: FocusableElement) -> bool:
      """
      Check whether the given control has the focus.
      :param value: :class:`.UIControl` or :class:`.Window` instance.
      """
      if isinstance(value, str):
          if self.current_buffer is None:
              return False
          return self.current_buffer.name == value
      if isinstance(value, Buffer):
          return self.current_buffer == value
      if isinstance(value, UIControl):
          return self.current_control == value
      else:
          value = to_container(value)
          if isinstance(value, Window):
              return self.current_window == value
          else:
              # Check whether this "container" is focused. This is true if
              # one of the elements inside is focused.
              for element in walk(value):
                  if element == self.current_window:
                      return True
              return False
  
imports: from __future__ import annotations
  from typing import Generator, Iterable, Union
  from prompt_toolkit.buffer import Buffer
  from .containers import AnyContainer, ConditionalContainer, Container, Window, to_container
  from .controls import BufferControl, SearchBufferControl, UIControl
label_desc: Use image node_id 6 for calling the Layout obj's underlying member method code with example usage: obj.has_focus(value) and returns: unknown, unknown, unknown, False, unknown, False, True