code: def _find_end_token(self, end_token, operation):
          
          ibuffer, icache = operation.state
          length = operation.buffered[ibuffer][2]
          result = None
  
          for i in range(len(operation.buffered) - ibuffer - 1):
              linenum, statement, charlength = operation.buffered[i + ibuffer + 1]
              length += charlength
              
              if end_token in statement.lower():
                  #We already have the absolute char index for the start of the
                  #instance; we just need to update the end.
                  result = (i + ibuffer + 1, length)
                  break        
  
          #If we didn't find a terminating statement, the full length of the operation
          #is a good estimate for the extent of the instance.
          if result is None:
              result = (None, length)
  
          return result
docs: Looks for a statement in the operation's list that matches the specified
          end token. Returns the index of the statement in the operation that matches.