code: def _remove_end_gaps(sequence):
      '''Removes double-stranded gaps from ends of the sequence.
  
      :returns: The current sequence with terminal double-strand gaps ('-')
                removed.
      :rtype: coral.DNA
  
      '''
      # Count terminal blank sequences
      def count_end_gaps(seq):
          gap = coral.DNA('-')
          count = 0
          for base in seq:
              if base == gap:
                  count += 1
              else:
                  break
  
          return count
  
      top_left = count_end_gaps(sequence.top)
      top_right = count_end_gaps(reversed(sequence.top))
      bottom_left = count_end_gaps(reversed(sequence.bottom))
      bottom_right = count_end_gaps(sequence.bottom)
  
      # Trim sequence
      left_index = min(top_left, bottom_left)
      right_index = len(sequence) - min(top_right, bottom_right)
  
      return sequence[left_index:right_indexf _remove_end_gaps(sequence):
      '''Removes double-stranded gaps from ends of the sequence.
  
      :returns: The current sequence with terminal double-strand gaps ('-')
                removed.
      :rtype: coral.DNA
  
      '''
      # Count terminal blank sequences
      def count_end_gaps(seq):
          gap = coral.DNA('-')
          count = 0
          for base in seq:
              if base == gap:
                  count += 1
              else:
                  break
  
          return count
  
      top_left = count_end_gaps(sequence.top)
      top_right = count_end_gaps(reversed(sequence.top))
      bottom_left = count_end_gaps(reversed(sequence.bottom))
      bottom_right = count_end_gaps(sequence.bottom)
  
      # Trim sequence
      left_index = min(top_left, bottom_left)
      right_index = len(sequence) - min(top_right, bottom_right)
  
      return sequence[left_index:right_index]
docs: Removes double-stranded gaps from ends of the sequence.
  
      :returns: The current sequence with terminal double-strand gaps ('-')
                removed.
      :rtype: coral.DNA