def _get_fn_name(fn):
    """Try to inspect a function's name, taking into account several common
    non-standard types of function: dask, functools.partial ...
    """
    if hasattr(fn, '__name__'):
        return fn.__name__
    elif hasattr(fn, 'key'):
        return fn.key.partition('-')[0]
    elif hasattr(fn, 'func'):
        return fn.func.__name__
    else:
        raise ValueError('Could not extract function name from {}'.format(fn))
