code: def generalize_names(
      name, output_sep=" ", firstname_output_letters=1
  ):
      """Generalize a person's first and last name.
  
      Description : Returns a person's name in the format
      `<last_name><separator><firstname letter(s)> (all lowercase)`
  
      Parameters
      ----------
      name : `str`
          Name of the player
      output_sep : `str` (default: ' ')
          String for separating last name and first name in the output.
      firstname_output_letters : `int`
          Number of letters in the abbreviated first name.
  
      Returns
      ----------
      gen_name : `str`
          The generalized name.
  
      Examples
      -----------
      For usage examples, please see
      https://rasbt.github.io/mlxtend/user_guide/text/generalize_names/
  
      """
      # set first and last name positions
      last, first = "last", "first"
      last_pos = -1
  
      name = name.lower()
  
      # fix primarily Dutch names
      exc = ["van der ", "de ", "van ", "von ", "di "]
      for e in exc:
          if name.startswith(e):
              repl = e.replace(" ", "")
              name = repl + name[len(e) - 1 :].strip()
  
      exc = [
          " van der ",
          " de ",
          " van ",
          " von ",
          " di ",
          ", van der ",
          ", de",
          ", van ",
          ", von ",
          ", di ",
      ]
  
      for e in exc:
          name = name.replace(e, " " + e.replace(" ", ""))
  
      if "," in name:
          last, first = first, last
          name = name.replace(",", "")
          last_pos = 1
  
      spl = name.split()
      if len(spl) > 2:
          name = "%s %s" % (spl[0], spl[last_pos])
  
      # remove accents
      if sys.version_info.major == 2:
          name = name.decode("utf-8")
  
      name = "".join(
          x
          for x in unicodedata.normalize("NFKD", name)
          if x in string.ascii_letters + " "
      )
  
      # get first and last name if applicable
      m = re.match(r"(?P<first>\w+)\W+(?P<last>\w+)", name)
      if m:
          output = "%s%s%s" % (
              m.group(last),
              output_sep,
              m.group(first)[:firstname_output_letters],
          )
      else:
          output = name
  
      gen_name = output.strip()
      return gen_name
  
file_path: mlxtend/mlxtend/text/names.py
imports: import re
  import string
  import sys
  import unicodedata
  from packaging.version import Version
  from pandas import __version__
label_desc: Use image node_id 1 for calling a global function with example usage: generalize_names(name, output_sep, firstname_output_letters) and returns: gen_name