from typing import Union
from typing import List
from typing import Any


def has_multiple_references(summaries: Union[List[List[str]], List[List[List[str]]]]) -> bool:
    """
    Checks to see if ``summaries`` has multiple references or not by examining
    the type of the summaries. Each individual summary is represented as ``List[str]``.
    If the type is ``List[List[str]]``, there is one summary per instance. If the
    type is ``List[List[List[str]]]``, there are multiple summaries per instance.
    """
    def _is_summary(maybe_summary: Union[List[str], Any]) -> bool:
        return isinstance(maybe_summary, list) and all(isinstance(item, str) for item in maybe_summary)

    if isinstance(summaries, list):
        if all(_is_summary(maybe_summary) for maybe_summary in summaries):
            return False
        for instance_summaries in summaries:
            if not all(_is_summary(maybe_summary) for maybe_summary in instance_summaries):
                raise Exception('``summaries`` is neither ``List[List[str]]`` nor ``List[List[List[str]]]``.')
        return True