def METHOD_NAME(self, msg_id):
    """ Returns a mock IPython application with a mocked kernel """
    kernel = type(
        'mock_kernel',
        (object, ),
        {'_parent_header': {'header': {'msg_id': msg_id}}}
    )
    # Specifically override this so the traceback
    # is still printed to screen
    def showtraceback(self_, exc_tuple, *args, **kwargs):
        etype, evalue, tb = exc_tuple
        raise etype(evalue)
    ipython = type(
        'mock_ipython',
        (object, ),
        {'kernel': kernel, 'showtraceback': showtraceback}
    )
    return ipython