def gc_and_coverage_for_region(bam_fp, fasta_fp, region):
  """Compute GC content (as a fraction) and average coverage for this region

  :param bam_fp:
  :param fasta_fp:
  :param region: e.g. "1:10000-20000"
  :return: gc, cov
  """
  seq = fasta_fp.fetch(region=region)
  if seq.count('N') / float(len(seq)) > 0.1:
    return None, None  # Probably centromere or telomere

  gc = float(seq.count('G') + seq.count('C')) / len(seq)
  cov_l = [b.n for b in bam_fp.pileup(region=region)]
  cov = float(sum(cov_l)) / max(len(cov_l), 1)

  return gc, cov