def METHOD_NAME(
    expr: str,
    xx: xr.Dataset,
    dtype=None,
    name="result",
    casting="safe",
    order="K",
    **params,
):
    """
    Apply numexpr to variables within a Dataset.
    numexpr library offers a limited subset of types and operations supported
    by numpy, but is much faster and memory efficient, particularly for complex
    expressions. See numexpr documentation for a more detailed explanation of
    performance advantages of using this library over numpy operations,
    summary: single pass over input memory, no temporary arrays, cache
    locality.
    :param expr: Numexpr compatible string to evaluate
    :param xx: Dataset object that contains arrays to be used in the ``expr`` (can be Dask)
    :param dtype: specify output dtype
    :param name: Used to name computation when input is Dask
    :param casting: Passed to ``numexpr.evaluate``
    :param order: Passed to ``numexpr.evaluate``
    :param params: Any other constants you use in the expression
    :raturns: xr.DataArray containing result of the equation (Dask is input is Dask)
    Example:
    .. code-block:: python
       # Given a Dataset with bands `red` and `nir`
       xx = dc.load(..., measurements=["red", "nir"], dask_chunks={})
       # Compute NDVI (ignore nodata for simplicity of the example)
       ndvi = apply_numexpr("(_1f*nir - red)/(_1f*nir + red)",
                            xx,
                            dtype='float32',   # Output is float32
                            _1f=np.float32(1)  # Define constant `_1f` being a float32(1),
                                               # used for casting to float32
                           )
    """
    bands = {}
    sample_band = None
    for band, x in xx.data_vars.items():
        band = str(band)
        if band in params:
            raise ValueError(f"Variable: `{band}` is aliased by a parameter")
        if band in expr:
            bands[band] = x.data
            if sample_band is None:
                sample_band = x
    if sample_band is None:
        raise ValueError("Found no bands on input")
    op = functools.partial(
        apply_numexpr_np, expr, dtype=dtype, casting=casting, order=order, **params
    )
    if dask.is_dask_collection(xx):
        # Passing through dictionary of Dask Arrays didn't work, so we have
        # adaptor that accepts var args in the form of [k0,v0,  k1,v1, ...] and then reconstructs dict
        data = da.map_blocks(
            lambda op, *bands: op(unflatten_kv(bands)),
            op,
            *flatten_kv(bands),
            name=randomize(name),
            dtype=dtype,
        )
    else:
        data = op(bands)
    return xr.DataArray(
        data=data,
        attrs=sample_band.attrs,
        dims=sample_band.dims,
        coords=sample_band.coords,
        name=name,
    )