Remove handlers of a given `event`. If no event is informed, wipe
    out all events registered.

    Be careful!! This function is intended to help when writing tests
    and for debugging purposes. If you call it, all handlers associated
    to an event (or to all of them) will be disassociated. Which means
    that you'll have to reload all modules that teclare handlers. I'm
    sure you don't want it.

def cleanup_handlers(event=None):
    """Remove handlers of a given `event`. If no event is informed, wipe
    out all events registered.

    Be careful!! This function is intended to help when writing tests
    and for debugging purposes. If you call it, all handlers associated
    to an event (or to all of them) will be disassociated. Which means
    that you'll have to reload all modules that teclare handlers. I'm
    sure you don't want it.
    """
    if event:
        if event in HANDLER_REGISTRY:
            del HANDLER_REGISTRY[event]
        if event in EXTERNAL_HANDLER_REGISTRY:
            del EXTERNAL_HANDLER_REGISTRY[event]
    else:
        HANDLER_REGISTRY.clear()
        EXTERNAL_HANDLER_REGISTRY.clear()