code: def generate_minimal_name_variations(author_name):
      
      parsed_name = ParsedName.loads(unidecode(author_name))
  
      if len(parsed_name) > 1:
          lastnames = parsed_name.last.replace('-', ' ')
  
          non_lastnames = ' '.join(
              parsed_name.first_list + parsed_name.suffix_list
          )
          # Strip extra whitespace added if any of middle_list and suffix_list are empty.
          non_lastnames = non_lastnames.strip().replace('-', ' ')
  
          # Adding into a set first, so as to drop identical name variations.
          return list({
              name_variation.lower()
              for name_variation
              in [
                  lastnames + ' ' + non_lastnames,
                  lastnames + ' ' + non_lastnames[0],
                  non_lastnames + ' ' + lastnames,
                  non_lastnames + ' ' + lastnames[0],
              ]
              if not _name_variation_has_only_initials(name_variation)
          })
      else:
          return [parsed_name.dumps().replace('-', ' ').lower()]
docs: Generate a small number of name variations.
  
      Notes:
          Unidecodes the name, so that we use its transliterated version, since this is how the field is being indexed.
  
          For names with more than one part, {lastname} x {non lastnames, non lastnames initial} variations.
          Additionally, it generates the swapped version of those, for supporting queries like ``Mele Salvatore`` which
          ``ParsedName`` parses as lastname: Salvatore and firstname: Mele. So in those cases, we need to generate both
          ``Mele, Salvatore`` and ``Mele, S``.
  
          Wherever, the '-' is replaced by ' ', it's done because it's the way the name variations are being index, thus
          we want our minimal name variations to be generated identically. This has to be done after the creation of
          ParsedName, otherwise the name is parsed differently. E.g. 'Caro-Estevez' as is, it's a lastname, if we replace
          the '-' with ' ', then it's a firstname and lastname.