code: def has_aligned_reads(align_bam, region=None):
      
      import pybedtools
      if region is not None:
          if isinstance(region, six.string_types) and os.path.isfile(region):
              regions = [tuple(r) for r in pybedtools.BedTool(region)]
          else:
              regions = [region]
      with pysam.Samfile(align_bam, "rb") as cur_bam:
          if region is not None:
              for region in regions:
                  if isinstance(region, six.string_types):
                      for item in cur_bam.fetch(str(region)):
                          return True
                  else:
                      for item in cur_bam.fetch(str(region[0]), int(region[1]), int(region[2])):
                          return True
          else:
              for item in cur_bam:
                  if not item.is_unmapped:
                      return True
      return False
docs: Check if the aligned BAM file has any reads in the region.
  
      region can be a chromosome string ("chr22"),
      a tuple region (("chr22", 1, 100)) or a file of regions.