def input(name, default=None, foreach=None):
    """Decorator to declare input for a node.

    Plain inputs, that is plain python objects, are directly passed to
    the node. Whereas streams generated by other nodes are requested
    and once the handles of all input streams are available the node
    is instantiated.

    Args:
        name (str): Name of the node function argument the input will
            be passed to.
        default: An optional default value for the input. This can be
            any python object or another node.
        foreach (bool): This parameter is currently not supported and
            only for internal usage.

    Returns:
        The original function decorated with this input
        specification. A function is turned into a node by the
        :func:`node` decorator.

    """
    assert default is None or foreach is None
    value = foreach if foreach is not None else default
    value = StreamSpec(value) if isinstance(value, Node) else value
    foreach = foreach is not None
    spec = InputSpec(name, value, foreach)
    def deco(func):
        """Add {!r} to function.""".format(spec)
        specs = func.__dict__.setdefault('__marv_input_specs__', OrderedDict())
        if spec.name in specs:
            raise InputNameCollision(spec.name)
        specs[spec.name] = spec
        return func
    return deco