code: def get_inserts(block):
      
      def find_inserts(seq, head_len):
          """Locate the lowercase regions in a character sequence.
  
          Yield the insert ranges as tuples using 1-based numbering, shifted by
          head_len.
          """
          in_insert = False
          curr_start = None
          deletions = 0
          for idx, is_lower in enumerate(map(str.islower, seq)):
              if is_lower:
                  if not in_insert:
                      # Start of a new insert region
                      curr_start = head_len + idx + 1 - deletions
                      in_insert = True
              else:
                  if in_insert:
                      # End of the current insert region
                      yield (curr_start, head_len + idx - deletions)
                      in_insert = False
                  if seq[idx] == '-':
                      deletions += 1
  
  
      return dict((record['id'],
                      list(find_inserts(record['seq'], record['head_len'])))
                  for record in block['sequences'])
docs: Identify the inserts in sequence in a block.
  
      Inserts are relative to the consensus (theoretically), and identified by
      lowercase letters in the sequence. The returned integer pairs represent the
      insert start and end positions in the full-length sequence, using one-based
      numbering.
  
      The first sequence of the CMA block is included, though it may just be the
      consensus sequence, which shouldn't have any inserts.
  
      Output:
          {id1: [(start, end), (start, end), ...], id2: ..., ...}