def run_interaction(f, args, kwargs):
    """
    Run an interaction function, which may yield FrontEndOperation
    objects to interact with the front end.
    """
    g = f(*args, **kwargs)

    def advance(to_send=None):
        try:
            op = g.send(to_send)
        except __HOLE__:
            return
        except InteractionError as e:
            ShowModal("Error", [widgets.Latex(e.message)]).submit()
        else:
            op.submit(advance)

    advance()
dataset/ETHPy150Open Microsoft/ivy/ivy/ui_extensions_api.py/run_interaction