def has_parent_authority(msg, _stream=None):
    """Policy function for use with :class:`Receiver` and
    :meth:`Router.add_handler` that requires incoming messages to originate
    from a parent context, or on a :class:`Stream` whose :attr:`auth_id
    <Stream.auth_id>` has been set to that of a parent context or the current
    context."""
    return (msg.auth_id == mitogen.context_id or
            msg.auth_id in mitogen.parent_ids)