code: def _add_meta(xs, sample=None, config=None):
      out = []
      for x in xs:
          if not isinstance(x["path"], six.string_types) or not os.path.exists(x["path"]):
              raise ValueError("Unexpected path for upload: %s" % x)
          x["mtime"] = shared.get_file_timestamp(x["path"])
          if sample:
              sample_name = dd.get_sample_name(sample)
              if "sample" not in x:
                  x["sample"] = sample_name
              elif x["sample"] != sample_name:
                  x["run"] = sample_name
          if config:
              fc_name = config.get("fc_name") or "project"
              fc_date = config.get("fc_date") or datetime.datetime.now().strftime("%Y-%m-%d")
              x["run"] = "%s_%s" % (fc_date, fc_name)
          out.append(x)
      return out