def _is_non_interactive_terminal_ipython(ip):
    """
    Return whether we are in a a terminal IPython, but non interactive.

    When in _terminal_ IPython, ip.parent will have and `interact` attribute,
    if this attribute is False we do not setup eventloop integration as the
    user will _not_ interact with IPython. In all other case (ZMQKernel, or is
    interactive), we do.
    """
    return hasattr(ip, 'parent') and ip.parent is not None and getattr(ip.
        parent, 'interact', None) is False
