class_docstr: An nbconvert preprocessor that substitutes one set of HTML data
  output for another, adding annotation to the output as required.
  
  The constructor accepts the notebook format version and a
  substitutions dictionary:
  
  {source_html:(target_html, annotation)}
  
  Where the annotation may be None (i.e. no annotation).
code: def preprocess_cell(self, cell, resources, index):
      v4 = self.nbversion[0] == 4
      if cell["cell_type"] == "code":
          for outputs in cell["outputs"]:
              output_key = "execute_result" if v4 else "pyout"
              if outputs["output_type"] == output_key:
                  # V1-3
                  if not v4 and "html" in outputs:
                      outputs["html"] = self.replace(outputs["html"])
                  # V4
                  for data in outputs.get("data", []):
                      if v4 and data == "text/html":
                          substitution = self.replace(
                              outputs["data"]["text/html"]
                          )
                          outputs["data"]["text/html"] = substitution
      return cell, resources
  
imports: import ast
  from nbconvert.preprocessors import Preprocessor
label_desc: Use image node_id 4 for calling the Substitute obj's underlying member method code with example usage: obj.preprocess_cell(cell, resources, index) and returns: cell,  resources