code: def _set_global_vars(metadata):
      
      fnames = collections.defaultdict(list)
      for sample in metadata.keys():
          for k, v in metadata[sample].items():
              if isinstance(v, six.string_types) and os.path.isfile(v):
                  v = _expand_file(v)
                  metadata[sample][k] = v
                  fnames[v].append(k)
      global_vars = {}
      # Skip global vars -- more confusing than useful
      # loc_counts = collections.defaultdict(int)
      # global_var_sub = {}
      # for fname, locs in fnames.items():
      #     if len(locs) > 1:
      #         loc_counts[locs[0]] += 1
      #         name = "%s%s" % (locs[0], loc_counts[locs[0]])
      #         global_var_sub[fname] = name
      #         global_vars[name] = fname
      # for sample in metadata.keys():
      #     for k, v in metadata[sample].items():
      #         if isinstance(v, six.string_types) and v in global_var_sub:
      #             metadata[sample][k] = global_var_sub[v]
      return metadata, global_vars
docs: Identify files used multiple times in metadata and replace with global variables