def is_message_handler(type_, from_, cb):
    """
    Return true if `cb` has been decorated with :func:`message_handler` for the
    given `type_` and `from_`.
    """

    try:
        handlers = aioxmpp.service.get_magic_attr(cb)
    except AttributeError:
        return False

    return aioxmpp.service.HandlerSpec(
        (_apply_message_handler, (type_, from_)),
        require_deps=(
            SimpleMessageDispatcher,
        )
    ) in handlers