import ast


def get_slice_expr(node: ast.Subscript) -> ast.expr:
    """
    Get slice expresion from the subscript in all versions of python.

    It was changed in ``python3.9``.

    Before: ``ast.Subscript`` -> ``ast.Index`` -> ``ast.expr``
    After: ``ast.Subscript`` -> ``ast.expr``
    """
    return (
        node.slice.value  # type: ignore
        if isinstance(node.slice, ast.Index)
        else node.slice
    )