code: def clean_for_doc(nb):
      
      new_cells = []
      for cell in nb.worksheets[0].cells:
          # Remove the pylab inline line.
          if "input" in cell and cell["input"].strip() == "%pylab inline":
              continue
          # Remove output resulting from the stream/trace method chaining.
          if "outputs" in cell:
              outputs = [_i for _i in cell["outputs"] if "text" not in _i or
                         not _i["text"].startswith("<obspy.core")]
              cell["outputs"] = outputs
          new_cells.append(cell)
      nb.worksheets[0].cells = new_cells
      return nb
docs: Cleans the notebook to be suitable for inclusion in the docs.