def METHOD_NAME(namespace, function_code, result_name):
    # On executing the function inside the namespace, its result will be in a
    # variable named result_name.
    exec(function_code, namespace, namespace)
    result = namespace.get(result_name)
    return result