code: def action(tuple_list, action):
      # discard the warm up
      if args.discard > 0:
          tuple_list = tuple_list[args.discard :]
          tuple_list = tuple_list[: -args.discard]
      # do action for each item
      if action == "sum":
          print(sum(tuple_list))
      elif action == "mean":
          if len(tuple_list) == 0:
              print("null")
          else:
              print(sum(tuple_list) / len(tuple_list))
      elif action == "print":
          for item in tuple_list:
              print(item)
      else:
          raise RuntimeError(
              "Invalid reduction_expr : `{}`".format(action)
          )
  
file_path: PaddleSeg/test_tipc/extract_loss.py
imports: import sys
  import argparse
  import re
label_desc: Use image node_id 5 for calling a global function with example usage: action(tuple_list, action) without return types