def METHOD_NAME(
    enabled: typing.Optional[bool], loop: asyncio.AbstractEventLoop, propagate_interrupts: bool
) -> typing.Generator[None, None, None]:
    """Context manager which cleanly exits on signal interrupts.
    Parameters
    ----------
    enabled : typing.Optional[bool]
        Whether to enable the signal interrupts.
        If set to `None`, then it will be enabled or not based on whether the running
        thread is the main one or not.
    loop : asyncio.AbstractEventLoop
        The event loop the interrupt will be raised in.
    propagate_interrupts : bool
        Whether to propagate interrupts.
    """
    if enabled is None:
        enabled = threading.current_thread() is threading.main_thread()
    if not enabled:
        # NOOP context manager
        yield
        return
    interrupt_handler = _interrupt_handler(loop)
    for sig in _INTERRUPT_SIGNALS:
        try:
            signum = getattr(signal, sig)
            signal.signal(signum, interrupt_handler)
        except AttributeError:
            _LOGGER.log(ux.TRACE, "signal %s is not implemented on your platform; skipping", sig)
    try:
        yield
    except errors.HikariInterrupt:
        if propagate_interrupts:
            raise
    finally:
        for sig in _INTERRUPT_SIGNALS:
            try:
                signum = getattr(signal, sig)
                signal.signal(signum, signal.SIG_DFL)
            except AttributeError:
                # Signal not implemented. We already logged this earlier.
                pass