def METHOD_NAME(
    output: DeferredArray,
    input: DeferredArray,
    argsort: bool,
    axis: Union[int, None] = -1,
    stable: bool = False,
) -> None:
    if axis is None and input.ndim > 1:
        sort_flattened(output, input, argsort, stable)
    else:
        if axis is None:
            computed_axis = 0
        else:
            computed_axis = normalize_axis_index(axis, input.ndim)
        if computed_axis == input.ndim - 1:
            sort_task(output, input, argsort, stable)
        else:
            sort_swapped(output, input, argsort, computed_axis, stable)