def has_kwargs(f):
    if sys.version_info[0] == 2:  # pragma: py3 no cover
        spec = inspect.getargspec(f)
        return bool(spec and (spec.keywords or spec.defaults))
    if sys.version_info[0] == 3:  # pragma: py2 no cover
        spec = inspect.getfullargspec(f)
        return bool(spec.defaults)
Does a function have keyword arguments?
dataset/ETHPy150Open pytoolz/toolz/toolz/functoolz.py/has_kwargs