class_docstr: :param get_size: A callable which returns the `Size` of the output terminal.
  :param stdout: Any object with has a `write` and `flush` method + an 'encoding' property.
  :param true_color: Use 24bit color instead of 256 colors. (Can be a :class:`SimpleFilter`.)
      When `ansi_colors_only` is set, only 16 colors are used.
  :param ansi_colors_only: Restrict to 16 ANSI colors only.
  :param term: The terminal environment variable. (xterm, xterm-256color, linux, ...)
  :param write_binary: Encode the output before writing it. If `True` (the
      default), the `stdout` object is supposed to expose an `encoding` attribute.
docstr: Create an Output class from a pseudo terminal.
  (This will take the dimensions by reading the pseudo
  terminal attributes.)
docstr_tok: ["Create","an","Output","class","from","a","pseudo","terminal",".","(","This","will","take","the","dimensions","by","reading","the","pseudo","terminal","attributes",".",")"]
code: def from_pty(
      cls, stdout, true_color=False, ansi_colors_only=None, term=None
  ):
      """
      Create an Output class from a pseudo terminal.
      (This will take the dimensions by reading the pseudo
      terminal attributes.)
      """
      assert stdout.isatty()
  
      def get_size():
          rows, columns = _get_size(stdout.fileno())
          # If terminal (incorrectly) reports its size as 0, pick a reasonable default.
          # See https://github.com/ipython/ipython/issues/10071
          return Size(rows=(rows or 24), columns=(columns or 80))
  
      return cls(
          stdout,
          get_size,
          true_color=true_color,
          ansi_colors_only=ansi_colors_only,
          term=term,
      )
  
imports: from __future__ import unicode_literals
  from prompt_toolkit.filters import to_simple_filter, Condition
  from prompt_toolkit.layout.screen import Size
  from prompt_toolkit.renderer import Output
  from prompt_toolkit.styles import ANSI_COLOR_NAMES
  from six.moves import range
  import array
  import errno
  import os
  import six
label_desc: Use image node_id 2 for calling the Vt100_Output obj's underlying member method code with example usage: obj.from_pty(cls, stdout, true_color, ansi_colors_only, term) and returns: cls, Size