code: def gen_nodes_file(file_, result_file):
      """calculate the total number of nodes and save them for latter processing."""
      nodes = []
      with open(file_, "r") as reader:
          for line in reader:
              tokens = line.strip().split(" ")
              nodes.append(tokens[1])
              nodes.append(tokens[2])
  
      nodes = list(set(nodes))
      nodes.sort(key=int)
      print("total number of nodes: %d" % len(nodes))
      print("saving nodes file in %s" % (result_file))
      with open(result_file, "w") as writer:
          for n in nodes:
              writer.write(n + "\n")
  
      print("finished")
  
label_desc: Use image node_id 1 for calling a global function with example usage: gen_nodes_file(file_, result_file) without return types