def METHOD_NAME(webview, task, *user_data):
    """If `evaluate_javascript_finish` from GTK returns a result, unmarshal it, and
    call back with the result."""
    try:
        value = webview.evaluate_javascript_finish(task)
        if value.is_boolean():
            value = value.to_boolean()
        elif value.is_number():
            value = value.to_double()
        else:
            value = value.to_string()
        result.future.set_result(value)
        if on_result:
            on_result(value)
    except Exception as e:
        exc = RuntimeError(str(e))
        result.future.set_exception(exc)
        if on_result:
            on_result(None, exception=exc)