def decorate_all_in_module(module_: ModuleType, decorator: FunctionType, whitelist: list):
    '\n    Decorate all functions in a module with the specified decorator\n    :param module_: The module to interrogate\n    :param decorator: The decorator to apply\n    :param whitelist: Functions not to be decorated.\n    '
    for name in dir(module_):
        if (name not in whitelist):
            obj = getattr(module_, name)
            if (isinstance(obj, FunctionType) or asyncio.iscoroutinefunction(obj)):
                if (obj.__module__ == module_.__name__):
                    logger.debug(f'Adding metrics to {module_}:{name}')
                    setattr(module_, name, decorator(obj))
                else:
                    logger.debug(f'No metrics on {module_}:{name} because it belongs to another module')
            else:
                logger.debug(f'No metrics on {module_}:{name} because it is not a coroutine or function')
Decorate all functions in a module with the specified decorator
:param module_: The module to interrogate
:param decorator: The decorator to apply
:param whitelist: Functions not to be decorated.
def decorate_all_in_module(module_: ModuleType, decorator: FunctionType, whitelist: list):
    '\n    Decorate all functions in a module with the specified decorator\n    :param module_: The module to interrogate\n    :param decorator: The decorator to apply\n    :param whitelist: Functions not to be decorated.\n    '
    for name in dir(module_):
        if (name not in whitelist):
            obj = getattr(module_, name)
            if (isinstance(obj, FunctionType) or asyncio.iscoroutinefunction(obj)):
                if (obj.__module__ == module_.__name__):
                    logger.debug(f'Adding metrics to {module_}:{name}')
                    setattr(module_, name, decorator(obj))
                else:
                    logger.debug(f'No metrics on {module_}:{name} because it belongs to another module')
            else:
                logger.debug(f'No metrics on {module_}:{name} because it is not a coroutine or function')