code: def ipy_valid_lines(block):
      lines = ipy_lines(block)
  
      # matplotlib handling
      for line in lines:
          if (
              "import matplotlib.pyplot as plt" in line
              or "%matplotlib inline" in line
          ):
              import matplotlib
  
              matplotlib.use("Agg", warn=False)
  
      # remove ipython magic functions
      lines = [line for line in lines if not line.startswith("%")]
  
      # don't show any plots
      lines = [line for line in lines if "plt.show()" not in line]
  
      return lines
  
imports: import json
  import codecs
label_desc: Use image node_id 5 for calling a global function with example usage: ipy_valid_lines(block) and returns: lines