class_docstr: An embedded IPython instance to run inside Sphinx
docstr: process block from the block_parser and return a list of processed lines
docstr_tok: ["process","block","from","the","block_parser","and","return","a","list","of","processed","lines"]
code: def process_block(self, block):
      """
      process block from the block_parser and return a list of processed lines
      """
      ret = []
      output = None
      input_lines = None
      lineno = self.IP.execution_count
  
      input_prompt = self.promptin % lineno
      output_prompt = self.promptout % lineno
      image_file = None
      image_directive = None
  
      found_input = False
      for token, data in block:
          if token == COMMENT:
              out_data = self.process_comment(data)
          elif token == INPUT:
              found_input = True
              (
                  out_data,
                  input_lines,
                  output,
                  is_doctest,
                  decorator,
                  image_file,
                  image_directive,
              ) = self.process_input(data, input_prompt, lineno)
          elif token == OUTPUT:
              if not found_input:
                  TAB = " " * 4
                  linenumber = 0
                  source = "Unavailable"
                  content = "Unavailable"
                  if self.directive:
                      linenumber = (
                          self.directive.state.document.current_line
                      )
                      source = (
                          self.directive.state.document.current_source
                      )
                      content = self.directive.content
                      # Add tabs and join into a single string.
                      content = "\n".join(
                          [TAB + line for line in content]
                      )
  
                  e = (
                      "\n\nInvalid block: Block contains an output prompt "
                      "without an input prompt.\n\n"
                      "Document source: {0}\n\n"
                      "Content begins at line {1}: \n\n{2}\n\n"
                      "Problematic block within content: \n\n{TAB}{3}\n\n"
                  )
                  e = e.format(
                      source, linenumber, content, block, TAB=TAB
                  )
  
                  # Write, rather than include in exception, since Sphinx
                  # will truncate tracebacks.
                  sys.stdout.write(e)
                  raise RuntimeError("An invalid block was detected.")
              out_data = self.process_output(
                  data,
                  output_prompt,
                  input_lines,
                  output,
                  is_doctest,
                  decorator,
                  image_file,
              )
              if out_data:
                  # Then there was user submitted output in verbatim mode.
                  # We need to remove the last element of `ret` that was
                  # added in `process_input`, as it is '' and would introduce
                  # an undesirable newline.
                  assert ret[-1] == ""
                  del ret[-1]
  
          if out_data:
              ret.extend(out_data)
  
      # save the image files
      if image_file is not None:
          self.save_image(image_file)
  
      return ret, image_directive
  
imports: import atexit
  import errno
  import os
  import pathlib
  import re
  import sys
  import tempfile
  import ast
  import warnings
  import shutil
  from io import StringIO
  from docutils.parsers.rst import directives
  from docutils.parsers.rst import Directive
  from sphinx.util import logging
  from traitlets.config import Config
  from IPython import InteractiveShell
  from IPython.core.profiledir import ProfileDir
label_desc: Use image node_id 11 for calling the EmbeddedSphinxShell obj's underlying member method code with example usage: obj.process_block(block) and returns: ret,  image_directive