def combineName(namesList, givenName = None):
    """
    Generate a name from a set of names, and an optional pre-given name.

    Parameters
    ----------
    namesList : list of str
        The list of names to be combined.
    givenName : str, optional
        A pre-given name. If not given, then we combine the names in namesList.

    Returns
    -------
    str
        The combined name if givenName is None, or just the pre-given name.
    """
    if (givenName is None):
        return '|'.join(namesList)
    else:
        return givenName