human
I wrote the below code

    def decorator(func):
        @wraps(func)
        def func_with_caching(*args, **kwargs):
            key = keyfunc(*args, **kwargs)
            val = cache_get(key, cache_name=cache_name)
            extra = ''
            if (cache_name == 'database'):
                extra = '.dbcache'
            if (with_statsd_key is not None):
                metric_key = with_statsd_key
            else:
                metric_key = statsd_key(key)
            status = ('hit' if (val is not None) else 'miss')
            statsd.incr(('cache%s.%s.%s' % (extra, metric_key, status)))
            if (val is not None):
                return val[0]
            val = func(*args, **kwargs)
            cache_set(key, val, cache_name=cache_name, timeout=timeout)
            return val
        return func_with_caching
    return decorator

What's a good function header?
assistant
#Here's a good function header.

def cache_with_key(keyfunc, cache_name=None, timeout=None, with_statsd_key=None):