<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _summarize_combined(samples, vkey):
 """Prepare summarized CSV and plot files for samples to combine together. Helps handle cases where we want to summarize over multiple samples. """

    validate_dir = utils.safe_makedir(os.path.join(samples[0]["dirs"]["work"], vkey))
    combined, _ = _group_validate_samples(samples, vkey, [["metadata", "validate_combine"]])
    for vname, vitems in combined.items():
        if vname:
            cur_combined = collections.defaultdict(int)
            for data in sorted(vitems, key=lambda x: x.get("lane", dd.get_sample_name(x))):
                validations = [variant.get(vkey) for variant in data.get("variants", [])]
                validations = [v for v in validations if v]
                if len(validations) == 0 and vkey in data:
                    validations = [data.get(vkey)]
                for validate in validations:
                    with open(validate["summary"]) as in_handle:
                        reader = csv.reader(in_handle)
                        next(reader)  # header
                        for _, caller, vtype, metric, value in reader:
                            cur_combined[(caller, vtype, metric)] += int(value)
            out_csv = os.path.join(validate_dir, "grading-summary-%s.csv" % vname)
            with open(out_csv, "w") as out_handle:
                writer = csv.writer(out_handle)
                header = ["sample", "caller", "vtype", "metric", "value"]
                writer.writerow(header)
                for (caller, variant_type, category), val in cur_combined.items():
                    writer.writerow(["combined-%s" % vname, caller, variant_type, category, val])
            plots = validateplot.classifyplot_from_valfile(out_csv)