<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _cnn_tranch_filtering(in_file, vrn_files, tensor_type, data):
 """Filter CNN scored VCFs in tranches using standard SNP and Indel truth sets. """

    out_file = "%s-filter.vcf.gz" % utils.splitext_plus(in_file)[0]
    if not utils.file_uptodate(out_file, in_file):
        runner = broad.runner_from_config(data["config"])
        gatk_type = runner.gatk_type()
        assert gatk_type == "gatk4", "CNN filtering requires GATK4"
        if "train_hapmap" not in vrn_files:
            raise ValueError("CNN filtering requires HapMap training inputs: %s" % vrn_files)
        with file_transaction(data, out_file) as tx_out_file:
            params = ["-T", "FilterVariantTranches", "--variant", in_file,
                      "--output", tx_out_file,
                      "--snp-truth-vcf", vrn_files["train_hapmap"],
                      "--indel-truth-vcf", vrn_files["train_indels"]]
            if tensor_type == "reference":
                params += ["--info-key", "CNN_1D", "--tranche", "99"]
            else:
                assert tensor_type == "read_tensor"
                params += ["--info-key", "CNN_2D", "--tranche", "99"]
            runner.run_gatk(params)
    return vcfutils.bgzip_and_index(out_file, data["config"])