code: def concat(bed_files, catted=None):
      
      bed_files = [x for x in bed_files if x]
      if len(bed_files) == 0:
          if catted:
              # move to a .bed extension for downstream tools if not already
              sorted_bed = catted.sort()
              if not sorted_bed.fn.endswith(".bed"):
                  return sorted_bed.moveto(sorted_bed.fn + ".bed")
              else:
                  return sorted_bed
          else:
              return catted
  
      if not catted:
          bed_files = list(bed_files)
          catted = bt.BedTool(bed_files.pop())
      else:
          catted = catted.cat(bed_files.pop(), postmerge=False,
                              force_truncate=False)
  
      return concat(bed_files, catted)
docs: recursively concat a set of BED files, returning a
      sorted bedtools object of the result