docs: def _tidy_names(names, nnames, extra_names=None):
      """Truncate or extend names so that its len is nnames.
  
      The list is modified, this function returns nothing.
  
      Args:
          names (list): list of names.
          nnames (int): desired number of names.
          extra_names (list of str): list of names to be used to extend the list
              if needed. If this list isn't provided, a range is used instead.
      """
      if len(names) < nnames and extra_names is not None:
          names.extend(extra_names)
      names.extend(range(nnames - len(names)))
      del names[nnames:]