code: def soundex(s):
      _check_type(s)
  
      if not s:
          return ""
  
      s = _normalize(s)
      s = s.upper()
  
      replacements = (
          ("BFPV", "1"),
          ("CGJKQSXZ", "2"),
          ("DT", "3"),
          ("L", "4"),
          ("MN", "5"),
          ("R", "6"),
      )
      result = [s[0]]
      count = 1
  
      # find would-be replacement for first character
      for lset, sub in replacements:
          if s[0] in lset:
              last = sub
              break
      else:
          last = None
  
      for letter in s[1:]:
          for lset, sub in replacements:
              if letter in lset:
                  if sub != last:
                      result.append(sub)
                      count += 1
                  last = sub
                  break
          else:
              if letter != "H" and letter != "W":
                  # leave last alone if middle letter is H or W
                  last = None
          if count == 4:
              break
  
      result += "0" * (4 - count)
      return "".join(result)
  
file_path: jellyfish/python/jellyfish/_jellyfish.py
imports: import unicodedata
  from collections import defaultdict
  from itertools import zip_longest
  import warnings
label_desc: Use image node_id 8 for calling a global function with example usage: soundex(s) and returns: str, str