def pipe(cmd, *arguments, **kwargs):
    """
    Pipe many commands::

        >>> noop = pipe(['gzip'], ['gzip'], ['zcat'], ['zcat'])
        >>> _ = noop.stdin.write('foo'.encode())  # Ignore output in Python 3
        >>> noop.stdin.close()
        >>> print(noop.stdout.read().decode())
        foo

    Returns a Subprocess.
    """
    acc = run(*cmd, **kwargs)
    for cmd in arguments:
        if isinstance(cmd, Subprocess):
            acc = acc.pipe(cmd)
        else:
            acc = acc.pipe(*cmd, **kwargs)
    return acc