code: def merge(files, out_file, config):
      
      pair1 = [fastq_file[0] for fastq_file in files]
      if len(files[0]) > 1:
          path = splitext_plus(out_file)
          pair1_out_file = path[0] + "_R1" + path[1]
          pair2 = [fastq_file[1] for fastq_file in files]
          pair2_out_file = path[0] + "_R2" + path[1]
          _merge_list_fastqs(pair1, pair1_out_file, config)
          _merge_list_fastqs(pair2, pair2_out_file, config)
          return [pair1_out_file, pair2_out_file]
      else:
          return _merge_list_fastqs(pair1, out_file, config)
docs: merge smartly fastq files. It recognizes paired fastq files.