Turn function into node.

    Args:
        schema: capnproto schema describing the output messages format
        header: This parameter is currently not supported and only for
            internal usage.
        group (bool): A boolean indicating whether the default stream
            of the node is a group, meaning it will be used to
            published handles for streams or further groups. In case
            of :paramref:`marv.input.foreach` specifications this flag will
            default to `True`. This parameter is currently only for
            internal usage.
        version (int): This parameter currently has no effect.

    Returns:
        A :class:`Node` instance according to the given
        arguments and :func:`input` decorators.

def node(schema=None, header=None, group=None, version=None):
    """Turn function into node.

    Args:
        schema: capnproto schema describing the output messages format
        header: This parameter is currently not supported and only for
            internal usage.
        group (bool): A boolean indicating whether the default stream
            of the node is a group, meaning it will be used to
            published handles for streams or further groups. In case
            of :paramref:`marv.input.foreach` specifications this flag will
            default to `True`. This parameter is currently only for
            internal usage.
        version (int): This parameter currently has no effect.

    Returns:
        A :class:`Node` instance according to the given
        arguments and :func:`input` decorators.
    """
    def deco(func):
        """Turn function into node with given arguments.

        :func:`node`(schema={!r}, header={!r}, group={!r})
        """.format(schema, header, group)

        if isinstance(func, Node):
            raise TypeError('Attempted to convert function into node twice.')
        assert isgeneratorfunction(func), \
            "Node {}:{} needs to be a generator function".format(func.__module__,
                                                                 func.__name__)

        specs = getattr(func, '__marv_input_specs__', None)
        if hasattr(func, '__marv_input_specs__'):
            del func.__marv_input_specs__

        node = Node(func, schema=schema, header_schema=header,
                    group=group, specs=specs, version=version)
        functools.update_wrapper(node, func)
        return node
    return deco