def _GetDenseDimensions(list_of_lists):
    """Returns the inferred dense dimensions of a list of lists."""
    if not isinstance(list_of_lists, (list, tuple)):
        return []
    elif not list_of_lists:
        return [0]
    else:
        return [len(list_of_lists)] + _GetDenseDimensions(list_of_lists[0])