def add_to_module(module, name=None):
    """Decorator to register a function or class to a module"""
    def wrapper(value):
        key = name or getattr(value, '__name__', None)
        if key:
            setattr(module, key, value)
        return value
    return wrapper