code: def trim_slice(lines, slice_tuple):
      
      def _empty(line):
          return not line or line.strip() == '>'
  
      if not slice_tuple:
          return None
  
      slice_start, slice_end = slice_tuple
  
      if slice_start is None:
          slice_start = 0
      if slice_end is None:
          slice_end = len(lines)
  
      # Trim from beginning
      while slice_start < slice_end and _empty(lines[slice_start]):
          slice_start += 1
  
      # Trim from end
      while slice_end > slice_start and _empty(lines[slice_end-1]):
          slice_end -= 1
  
      return (slice_start, slice_end)
docs: Trim a slice tuple (begin, end) so it starts at the first non-empty line
      (obtained via indented_tree_line_generator / get_line_info) and ends at the
      last non-empty line within the slice. Returns the new slice.