Deduplicate config-clearing decorator code
Use functools.wraps in decorators