def _tidy_names(names, nnames, extra_names=None):
if len(names) < nnames and extra_names is not None:<EOL><INDENT>names.extend(extra_names)<EOL><DEDENT>names.extend(range(nnames - len(names)))<EOL>del names[nnames:]<EOL>
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.