def METHOD_NAME(self, engine, this_object, function):
    """Wrap a function in a bit of a javascript to re-trigger a method call on signal emit.
    This slightly magical method wraps a Python method exposed to QML in a JavaScript
    closure with the same signature as the Python method. This allows the closure to be
    exposed as a QML property instead of a QML slot. Using a property for this allows us
    to add a notify signal to re-trigger the method execution. Due to the way notify
    signals are handled by QML, re-triggering the method only needs a signal emit.
    :param engine: :type{QQmlEngine} The QML engine to use to evaluate JavaScript.
    :param this_object: :type{QObject} The object to call the function on.
    :param function: :type{Function} The function to call. Should be marked as pyqtSlot.
    :return: :type{QJSValue} A JavaScript closure that when called calls the wrapper Python method.
    :note Currently, only functions taking a fixed list of positional arguments are supported.
    :todo Move this to a more generic place so more things can use it.
    """
    # JavaScript code that wraps the Python method call in a closure
    wrap_js = """(function(this_object) {{
        return function({args}) {{ return this_object.{function}({args}) }}
    }})"""
    # Get the function name and argument list.
    function_name = function.__name__
    function_args = inspect.getfullargspec(function)[0]
    if function_args[0] == "self":
        function_args = function_args[1:] # Drop "self" from argument list
    # Replace arguments and function name with the proper values.
    wrapped_function = wrap_js.format(function = function_name, args = ", ".join(function_args))
    # Wrap the "this" object in a QML JSValue object.
    this_jsvalue = engine.newQObject(this_object)
    # Use the QML engine to evaluate the wrapped JS, then call that to retrieve the closure.
    result = engine.evaluate(wrapped_function).call([this_jsvalue])
    # Finally, return the resulting function.
    return result