input: 
  def calculate_rRNA_percentage(path_to_htseq_file: str, path_to_gtf_file: str) -> str:
      """This function calculates the percent of transcripts mapping to rRNA. It takes two inputs: an HTseq_counts file and a GTF file. The function extracts all the identifiers of genes/transcripts mapping to the rRNA and MT genes, counts reads matching the rRNA and MT identifiers, and writes the output to a summary file named after the HTseq_counts file with '_rRNAmtRNACounts' appended.
  
      >>> calculate_rRNA_percentage('/path/to/htseq_counts_file', '/path/to/gtf_file')
      'path/to/htseq_counts_file_rRNAmtRNACounts.txt'
      >>> calculate_rRNA_percentage('/Users/malwina/Documents/CTR-Data/htseq_counts.txt', '/Users/malwina/Documents/CTR-Data/genomes/Mus_musculus/mm10/Mus_musculus.GRCm38.84.gtf')
      '/Users/malwina/Documents/CTR-Data/htseq_counts_rRNAmtRNACounts.txt'
      """
  
      # Implementation of the function goes here
  
output:     
      import re
      from collections import defaultdict
  
      # Read the GTF file and extract rRNA and MT gene identifiers
      rRNA_mt_ids = set()
      with open(path_to_gtf_file, 'r') as gtf_file:
          for line in gtf_file:
              if line.startswith('#'):
                  continue
              fields = line.strip().split('\t')
              if fields[2] == 'gene':
                  gene_id = re.search(r'gene_id "([^"]+)"', fields[8]).group(1)
                  if 'rRNA' in fields[8] or 'MT' in fields[8]:
                      rRNA_mt_ids.add(gene_id)
  
      # Read the HTseq_counts file and count reads mapping to rRNA and MT genes
      rRNA_mt_counts = defaultdict(int)
      total_reads = 0
      with open(path_to_htseq_file, 'r') as htseq_file:
          for line in htseq_file:
              if line.startswith('__'):
                  continue
              gene_id, count = line.strip().split('\t')
              count = int(count)
              total_reads += count
              if gene_id in rRNA_mt_ids:
                  rRNA_mt_counts[gene_id] += count
  
      # Calculate the percentage of reads mapping to rRNA and MT genes
      rRNA_mt_total = sum(rRNA_mt_counts.values())
      rRNA_percentage = (rRNA_mt_total / total_reads) * 100
  
      # Write the output to a summary file
      output_file_name = path_to_htseq_file.rsplit('.', 1)[0] + '_rRNAmtRNACounts.txt'
      with open(output_file_name, 'w') as output_file:
          output_file.write(f"Total reads: {total_reads}\n")
          output_file.write(f"Reads mapping to rRNA and MT genes: {rRNA_mt_total}\n")
          output_file.write(f"Percentage of reads mapping to rRNA and MT genes: {rRNA_percentage:.2f}%\n")
  
      return output_file_name
  