def get_group_slices(expr):
    """Extracts the group slices from the given expression, if any.

    Args:
        expr: a :class:`ViewExpression` or an already serialized
            `MongoDB expression <https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#aggregation-expressions>`_

    Returns:
        a (possibly-empty) list of group slices
    """
    if isinstance(expr, ViewExpression):
        expr = expr.to_mongo()

    group_slices = set()
    _do_get_group_slices(expr, group_slices)

    return list(group_slices)
Extracts the group slices from the given expression, if any.

    Args:
        expr: a :class:`ViewExpression` or an already serialized
            `MongoDB expression <https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#aggregation-expressions>`_

    Returns:
        a (possibly-empty) list of group slices
    
fiftyone/core/expressions.py