Shrinks input_file to output_file.

    This function should be used only inside process_directory.
    It takes input_file, tries to shrink it and if shrink was successful
    save compressed image to output_file. Otherwise raise exception.

    @return compressed: PNGResponse

def _process_file(input_file, output_file, apikey):
    """Shrinks input_file to output_file.

    This function should be used only inside process_directory.
    It takes input_file, tries to shrink it and if shrink was successful
    save compressed image to output_file. Otherwise raise exception.

    @return compressed: PNGResponse
    """
    bytes_ = read_binary(input_file)
    compressed = shrink(bytes_, apikey)

    if compressed.success and compressed.bytes:
        write_binary(output_file, compressed.bytes)
    else:
        if compressed.errno in FATAL_ERRORS:
            raise StopProcessing(compressed)
        elif compressed.errno == TinyPNGError.InternalServerError:
            raise RetryProcessing(compressed)

    return compressed