code: def build_gen_func(args, graph, node_feat):
      """build_gen_func"""
      num_sample_workers = args.num_sample_workers
  
      if args.walkpath_files is None:
          walkpath_files = [None for _ in range(num_sample_workers)]
      else:
          files = get_file_list(args.walkpath_files)
          walkpath_files = [[] for i in range(num_sample_workers)]
          for idx, f in enumerate(files):
              walkpath_files[idx % num_sample_workers].append(f)
  
      if args.train_files is None:
          train_files = [None for _ in range(num_sample_workers)]
      else:
          files = get_file_list(args.train_files)
          train_files = [[] for i in range(num_sample_workers)]
          for idx, f in enumerate(files):
              train_files[idx % num_sample_workers].append(f)
  
      gen_func_pool = [
          GESReader(
              graph,
              node_feat,
              batch_size=args.batch_size,
              walk_len=args.walk_len,
              win_size=args.win_size,
              neg_num=args.neg_num,
              neg_sample_type=args.neg_sample_type,
              walkpath_files=walkpath_files[i],
              train_files=train_files[i],
          )
          for i in range(num_sample_workers)
      ]
      if num_sample_workers == 1:
          gen_func = gen_func_pool[0]
      else:
          gen_func = mp_reader.multiprocess_reader(
              gen_func_pool, use_pipe=True, queue_size=100
          )
      return gen_func
  
imports: import argparse
  import time
  import os
  import glob
  import numpy
  import paddle.fluid
  import paddle.fluid.layers
  from pgl.utils.logger import log
  from pgl.graph import Graph
  from pgl.sample import graph_alias_sample_table
  from pgl import data_loader
  import mp_reader
  from reader import GESReader
  from model import GESModel
label_desc: Use image node_id 4 for calling a global function with example usage: build_gen_func(args, graph, node_feat) and returns: gen_func