def _format_superfeature_ids(dynophore, superfeature_ids):
    """
    Format input superfeature IDs (e.g. when they come from IPyWidgets).
    Check if unknown superfeatures were given.

    Parameters
    ----------
    dynophore : dynophores.Dynophore
        Dynophore.
    superfeature_ids : str or list or tuple
        Superfeature IDs.

    Returns
    -------
    str or list of str
        Formated superfeature IDs. String if "all", else list of strings.
    """

    # IPyWidgets' interact function: Cast tuple > list
    if isinstance(superfeature_ids, tuple):
        superfeature_ids = list(superfeature_ids)

    if "all" in superfeature_ids:
        superfeature_ids = "all"
    else:
        if not isinstance(superfeature_ids, list):
            superfeature_ids = [superfeature_ids]
        for superfeature_id in superfeature_ids:
            dynophore._raise_keyerror_if_invalid_superfeature_id(superfeature_id)

    return superfeature_ids