code: def soundex_esp(word):
      word = word.lower()
      r = ""
  
      prevcode = None
      i = 0
      while i < len(word):
          code = None
          for expr, ecode in _esp_codes:
              match = expr.match(word, i)
              if match:
                  i = match.end()
                  code = ecode
                  break
  
          if code is None:
              code = word[i]
              i += 1
  
          if code != prevcode:
              r += code
          prevcode = code
  
      return r
  
imports: import re
  from whoosh.compat import iteritems
label_desc: Use image node_id 2 for calling a global function with example usage: soundex_esp(word) and returns: r