code: def preprocess_script_string(str):
      
  
      # Remove header comment
      str = re.sub(r'^(#[^#\n]+\n){5}\n*', r'', str)
      # Insert notebook plotting configuration function
      str = re.sub(r'from sporco import plot', r'from sporco import plot'
                   '\nplot.config_notebook_plotting()',
                   str, flags=re.MULTILINE)
      # Remove final input statement and preceding comment
      str = re.sub(r'\n*# Wait for enter on keyboard.*\ninput().*\n*',
                   r'', str, flags=re.MULTILINE)
  
      return str
docs: Process python script represented as string `str` in preparation
      for conversion to a notebook.  This processing includes removal of
      the header comment, modification of the plotting configuration,
      and replacement of certain sphinx cross-references with
      appropriate links to online docs.