code: def get_outdir(path, *paths, inc=False):
      outdir = os.path.join(path, *paths)
      if not os.path.exists(outdir):
          os.makedirs(outdir)
      elif inc:
          count = 1
          outdir_inc = outdir + "-" + str(count)
          while os.path.exists(outdir_inc):
              count = count + 1
              outdir_inc = outdir + "-" + str(count)
              assert count < 100
          outdir = outdir_inc
          os.makedirs(outdir)
      return outdir
  
imports: import csv
  import os
  from collections import OrderedDict
label_desc: Use image node_id 1 for calling a global function with example usage: get_outdir(path) and returns: outdir