code: def action(arguments):
      
      # Determine file format for input and output
      source_format = (arguments.source_format or
                       fileformat.from_handle(arguments.source_file))
      output_format = (arguments.output_format or
                       fileformat.from_handle(arguments.output_file))
  
      # Load the alignment
      with arguments.source_file:
          sequences = SeqIO.parse(
              arguments.source_file,
              source_format,
              alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))
  
          # Locate primers
          (forward_start, forward_end), (reverse_start, reverse_end) = locate_primers(
              sequences, arguments.forward_primer,
              arguments.reverse_primer, arguments.reverse_complement,
              arguments.max_hamming_distance)
  
          # Generate slice indexes
          if arguments.include_primers:
              start = forward_start
              end = reverse_end + 1
          else:
              start = forward_end + 1
              end = reverse_start
  
          # Rewind the input file
          arguments.source_file.seek(0)
          sequences = SeqIO.parse(
              arguments.source_file,
              source_format,
              alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))
  
          # Apply the transformation
          prune_action = _ACTIONS[arguments.prune_action]
          transformed_sequences = prune_action(sequences, start, end)
  
          with arguments.output_file:
              SeqIO.write(transformed_sequences, arguments.output_file,
                          output_format)
docs: Trim the alignment as specified