code: def get_terminal_size(p_getter=None):
      
  
      try:
          return get_terminal_size.getter()
      except AttributeError:
          if p_getter:
              get_terminal_size.getter = p_getter
          else:
              def inner():
                  try:
                      # shutil.get_terminal_size was added to the standard
                      # library in Python 3.3
                      try:
                          from shutil import get_terminal_size as _get_terminal_size  # pylint: disable=no-name-in-module
                      except ImportError:
                          from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size  # pylint: disable=import-error
  
                      size = _get_terminal_size()
                  except ValueError:
                      # This can result from the 'underlying buffer being detached', which
                      # occurs during running the unittest on Windows (but not on Linux?)
                      terminal_size = namedtuple('Terminal_Size', 'columns lines')
                      size = terminal_size(80, 24)
  
                  return size
  
              get_terminal_size.getter = inner
  
          return get_terminal_size.getter()
docs: Try to determine terminal size at run time. If that is not possible,
      returns the default size of 80x24.
  
      By default, the size is determined with provided get_terminal_size by
      shutil. Sometimes an UI may want to specify the desired width, then it can
      provide a getter that returns a named tuple (columns, lines) with the size.