code: def filter_output(fd_in):
      s = ""
      for line in fd_in:
          toks = line.split()
          if len(toks):
              if toks[0] == "File" and toks[-1].startswith("test"):
                  s += line
              elif toks[0].startswith("ImportError"):
                  s += line
              elif toks[0] in [
                  "KnownFailureTest:",
                  "Exception:",
                  "Failure:",
                  "AssertionError",
                  "AssertionError:",
                  "GradientError:",
              ]:
                  s += line
              elif toks[0] == "Executing" and toks[1] in [
                  "tests",
                  "nosetests",
              ]:
                  s += line
      return s
  
label_desc: Use image node_id 1 for calling a global function with example usage: filter_output(fd_in) and returns: s