code: def get_terminal_size():
      
      try:
          rows, columns = subprocess.check_output(['stty', 'size']).split()
      except subprocess.CalledProcessError:
          # not attached to terminal
          logger.info("not attached to terminal")
          return 0, 0
      logger.debug("console size is %s %s", rows, columns)
      return int(rows), int(columns)
docs: get size of console: rows x columns
  
      :return: tuple, (int, int)