input: 
  def calculate_rRNA_percent(htseq_counts_path: str, gtf_path: str) -> str:
      """ Calculate the percentage of transcripts mapping to rRNA and MT genes.
      The function takes two inputs: a path to an HTseq_counts file and a path to
      a GTF file. It extracts identifiers of rRNA and MT genes, counts the reads
      mapping to these identifiers, and outputs the results in a summary file.
      The summary file is named based on the HTseq counts file with 
      '_rRNAmtRNACounts.txt' appended.
      
      >>> calculate_rRNA_percent('/path/to/HTseq_counts.txt', '/path/to/GTF_file.gtf')
      'HTseq_counts_rRNAmtRNACounts.txt'
      >>> calculate_rRNA_percent('/another/path/to/HTseq_counts.txt', '/another/path/GTF_file.gtf')
      'another_path_to_HTseq_counts_rRNAmtRNACounts.txt'
      """
  
output:     import re
      import os
  
      def extract_gene_ids(gtf_path, gene_types):
          gene_ids = set()
          with open(gtf_path, 'r') as gtf_file:
              for line in gtf_file:
                  if not line.startswith('#'):
                      fields = line.split('\t')
                      if fields[2] == 'gene':
                          gene_info = fields[8]
                          gene_type = re.search(r'gene_biotype "([^"]+)"', gene_info)
                          gene_id = re.search(r'gene_id "([^"]+)"', gene_info)
                          if gene_type and gene_id:
                              if gene_type.group(1) in gene_types:
                                  gene_ids.add(gene_id.group(1))
          return gene_ids
  
      rRNA_MT_genes = extract_gene_ids(gtf_path, ['rRNA', 'Mt_rRNA', 'Mt_tRNA'])
  
      rRNA_MT_counts = 0
      total_counts = 0
  
      with open(htseq_counts_path, 'r') as htseq_file:
          for line in htseq_file:
              if not line.startswith('__'):
                  gene_id, count = line.rsplit(maxsplit=1)
                  count = int(count)
                  total_counts += count
                  if gene_id in rRNA_MT_genes:
                      rRNA_MT_counts += count
  
      rRNA_MT_percent = (rRNA_MT_counts / total_counts) * 100
  
      summary_file_name = os.path.basename(htseq_counts_path).rsplit('.', 1)[0] + '_rRNAmtRNACounts.txt'
      with open(summary_file_name, 'w') as summary_file:
          summary_file.write(f"Total counts: {total_counts}\n")
          summary_file.write(f"rRNA and MT counts: {rRNA_MT_counts}\n")
          summary_file.write(f"Percentage of rRNA and MT counts: {rRNA_MT_percent:.2f}%\n")
  
      return summary_file_name