Create a UNIX pipeline to process a file for uploading.
        (Compress, and optionally encrypt)

def get_upload_pipeline(in_fd, out_fd, rate_limit=None,
                        gpg_key=None, lzop=True):
    """ Create a UNIX pipeline to process a file for uploading.
        (Compress, and optionally encrypt) """
    commands = []
    if rate_limit is not None:
        commands.append(PipeViewerRateLimitFilter(rate_limit))
    if lzop:
        commands.append(LZOCompressionFilter())

    if gpg_key is not None:
        commands.append(GPGEncryptionFilter(gpg_key))

    return Pipeline(commands, in_fd, out_fd)