code: def stem(
      word: str,
      exception_list: Dict[str, str] = dict(),
      strip_pref: bool = True,
      strip_suf: bool = True,
  ) -> str:
      """
      :param words: string list
  
      The affix stemmer works by rule-based stripping. It can work on prefixes,
  
      >>> stem('yesterday')
      'day'
  
      suffixes,
  
      >>> stem('likingnes')
      'liking'
  
      or both
  
      >>> stem('yisterdayes')
      'day'
  
      You can also define whether the stemmer will strip suffixes
  
      >>> stem('yisterdayes', strip_suf = False)
      'dayes'
  
      or prefixes
  
      >>> stem('yisterdayes', strip_pref = False)
      'yisterday'
  
      The stemmer also accepts a user-defined dictionary, that essentially serves
      the function of a dictionary look-up stemmer
  
      >>> stem('arisnesse', exception_list = {'arisnesse':'rise'})
      'rise'
      """
  
      if word in exception_list:
          return exception_list[word]
  
      if len(word) <= 4:
          return word
  
      if strip_pref:
          for prefix in PREFIXES:
              if word.startswith(prefix):
                  word = word[len(prefix) :]
                  break
  
      if strip_suf:
          for en in ENDS:
              if len(word) <= 4:
                  break
  
              # Strip suffixes
              for suffix in SUFFIXES:
                  if len(suffix) <= len(en):
                      break
  
                  if (word + en).endswith(suffix):
                      word = word[: -len(suffix) + len(en)]
                      break
  
              if len(word) <= 4:
                  break
  
      return word
  
label_desc: Use image node_id 1 for calling a global function with example usage: stem(word, exception_list, strip_pref, strip_suf) and returns: word, exception_list, word