code: def config_notebook_plotting():
      
  
      # Check whether running within a notebook shell and have
      # not already monkey patched the plot function
      from sporco.util import in_notebook
      module = sys.modules[__name__]
      if in_notebook() and module.plot.__name__ == 'plot':
  
          # Set inline backend (i.e. %matplotlib inline) if in a notebook shell
          set_notebook_plot_backend()
  
          # Replace plot function with a wrapper function that discards
          # its return value (within a notebook with inline plotting, plots
          # are duplicated if the return value from the original function is
          # not assigned to a variable)
          plot_original = module.plot
  
          def plot_wrap(*args, **kwargs):
              plot_original(*args, **kwargs)
  
          module.plot = plot_wrap
  
          # Replace surf function with a wrapper function that discards
          # its return value (see comment for plot function)
          surf_original = module.surf
  
          def surf_wrap(*args, **kwargs):
              surf_original(*args, **kwargs)
  
          module.surf = surf_wrap
  
          # Replace contour function with a wrapper function that discards
          # its return value (see comment for plot function)
          contour_original = module.contour
  
          def contour_wrap(*args, **kwargs):
              contour_original(*args, **kwargs)
  
          module.contour = contour_wrap
  
          # Replace imview function with a wrapper function that discards
          # its return value (see comment for plot function)
          imview_original = module.imview
  
          def imview_wrap(*args, **kwargs):
              imview_original(*args, **kwargs)
  
          module.imview = imview_wrap
  
          # Disable figure show method (results in a warning if used within
          # a notebook with inline plotting)
          import matplotlib.figure
  
          def show_disable(self):
              pass
  
          matplotlib.figure.Figure.show = show_disable
docs: Configure plotting functions for inline plotting within a Jupyter
      Notebook shell. This function has no effect when not within a
      notebook shell, and may therefore be used within a normal python
      script.