def metalayerize(user_func):
def returned(layers, *args, **kwargs):<EOL><INDENT>def begin_update(X, *args, **kwargs):<EOL><INDENT>return user_func(layers, X, *args, **kwargs)<EOL><DEDENT>return FunctionLayer(begin_update, *args, **kwargs)<EOL><DEDENT>return returned<EOL>
Wrap a function over a sequence of layers and an input into a layer.