<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _prep_sample_and_config(ldetail_group, fastq_dir, fastq_final_dir):
 """Prepare output fastq file and configuration for a single sample. Only passes non-empty files through for processing. """

    files = []
    print("->", ldetail_group[0]["name"], len(ldetail_group))
    for read in ["R1", "R2"]:
        fastq_inputs = sorted(list(set(reduce(operator.add,
                                              (_get_fastq_files(x, read, fastq_dir) for x in ldetail_group)))))
        if len(fastq_inputs) > 0:
            files.append(_concat_bgzip_fastq(fastq_inputs, fastq_final_dir, read, ldetail_group[0]))
    if len(files) > 0:
        if _non_empty(files[0]):
            out = ldetail_group[0]
            out["files"] = files
            return out