# Buggy code
def f(values, axis=None, skipna=None, **kwargs):
    if kwargs.pop("out", None) is not None:
        raise TypeError(f"`out` is not valid for {name}")

    values = asarray(values)

    if coerce_strings and values.dtype.kind in "SU":
        values = values.astype(object)

    func = None
    if skipna or (skipna is None and values.dtype.kind in "cfO"):
        nanname = "nan" + name
        func = getattr(nanops, nanname)
    else:
        func = _dask_or_eager_func(name, dask_module=dask_module)

    try:
        return func(values, axis=axis, **kwargs)
    except AttributeError:
        if not is_duck_dask_array(values):
            raise
        try:  # dask/dask#3133 dask sometimes needs dtype argument
            # if func does not accept dtype, then raises TypeError
            return func(values, axis=axis, dtype=values.dtype, **kwargs)
        except (AttributeError, TypeError):
            raise NotImplementedError(f"{name} is not yet implemented on dask arrays")


# Traceback (TypeError)
In [37]: da.sum(min_count=1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-37-817bfdfe2211> in <module>
----> 1 da.sum(min_count=1)

~/code/xarray/xarray/core/common.py in wrapped_func(self, dim, axis, skipna, **kwargs)
44
45             def wrapped_func(self, dim=None, axis=None, skipna=None, **kwargs):
---> 46                 return self.reduce(func, dim, axis, skipna=skipna, **kwargs)
47
48         else:

~/code/xarray/xarray/core/dataarray.py in reduce(self, func, dim, axis, keep_attrs, keepdims, **kwargs)
2336         """
2337
-> 2338         var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
2339         return self._replace_maybe_drop_dims(var)
2340

~/code/xarray/xarray/core/variable.py in reduce(self, func, dim, axis, keep_attrs, keepdims, allow_lazy, **kwargs)
1591             data = func(input_data, axis=axis, **kwargs)
1592         else:
-> 1593             data = func(input_data, **kwargs)
1594
1595         if getattr(data, "shape", ()) == self.shape:

~/code/xarray/xarray/core/duck_array_ops.py in f(values, axis, skipna, **kwargs)
310
311         try:
--> 312             return func(values, axis=axis, **kwargs)
313         except AttributeError:
314             if not isinstance(values, dask_array_type):

~/code/xarray/xarray/core/duck_array_ops.py in f(*args, **kwargs)
46             else:
47                 wrapped = getattr(eager_module, name)
---> 48             return wrapped(*args, **kwargs)
49
50     else:

<__array_function__ internals> in sum(*args, **kwargs)

TypeError: _sum_dispatcher() got an unexpected keyword argument 'min_count'

# Fixed code
def f(values, axis=None, skipna=None, **kwargs):
    if kwargs.pop("out", None) is not None:
        raise TypeError(f"`out` is not valid for {name}")

    values = asarray(values)

    if coerce_strings and values.dtype.kind in "SU":
        values = values.astype(object)

    func = None
    if skipna or (skipna is None and values.dtype.kind in "cfO"):
        nanname = "nan" + name
        func = getattr(nanops, nanname)
    else:
        if name in ["sum", "prod"]:
            kwargs.pop("min_count", None)
        func = _dask_or_eager_func(name, dask_module=dask_module)

    try:
        return func(values, axis=axis, **kwargs)
    except AttributeError:
        if not is_duck_dask_array(values):
            raise
        try:  # dask/dask#3133 dask sometimes needs dtype argument
            # if func does not accept dtype, then raises TypeError
            return func(values, axis=axis, dtype=values.dtype, **kwargs)
        except (AttributeError, TypeError):
            raise NotImplementedError(f"{name} is not yet implemented on dask arrays")