code: def sample_negative_and_write_to_file_wrapper(
      otuput_file,
      pos_samples,
      neg_cnt,
      positive_pairs,
      item_list,
      sample_probs,
      process_num=1,
  ):
      p_list = []
      for i in range(process_num):
          outfile = otuput_file + "_part{0}".format(i)
          p = Process(
              target=sample_negative_and_write_to_file,
              args=(
                  outfile,
                  pos_samples,
                  neg_cnt,
                  positive_pairs,
                  item_list,
                  sample_probs,
                  False,
                  i,
                  process_num,
              ),
          )
          p.start()
          p_list.append(p)
      for p in p_list:
          p.join()
  
      ### merge files and delete temporary files.
      with open(otuput_file, "w") as wt:
          for i in range(process_num):
              infile = otuput_file + "_part{0}".format(i)
              with open(infile, "r") as rd:
                  while True:
                      line = rd.readline()
                      if not line:
                          break
                      if len(line) > 1:
                          wt.write(line)
              os.remove(infile)
  
imports: import codecs
  import pickle
  import time
  import os
  from datetime import datetime
  import random
  import numpy
  import math
  from multiprocessing import Process
  from utils.general import *
  from utils.data_helper import *
label_desc: Use image node_id 13 for calling a global function with example usage: sample_negative_and_write_to_file_wrapper(otuput_file, pos_samples, neg_cnt, positive_pairs, item_list, sample_probs, process_num) without return types