docs: def tokenize(string, language=None, escape='___'):
      """
      Given a string, return a list of math symbol tokens
      """
      # Set all words to lowercase
      string = string.lower()
  
      # Ignore punctuation
      if len(string) and not string[-1].isalnum():
          character = string[-1]
          string = string[:-1] + ' ' + character
  
      # Parenthesis must have space around them to be tokenized properly
      string = string.replace('(', ' ( ')
      string = string.replace(')', ' ) ')
  
      if language:
          words = mathwords.words_for_language(language)
  
          for phrase in words:
              escaped_phrase = phrase.replace(' ', escape)
              string = string.replace(phrase, escaped_phrase)
  
      tokens = string.split()
  
      for index, token in enumerate(tokens):
          tokens[index] = token.replace(escape, ' ')
  
      return tokens