human
Complete this python program:
def compute_codes_parallel(data, model, num_procs=4):
assistant
#Here is the Python program you requested.

    """A helper function that parallelizes the computation of LOPQ codes in
    a configurable number of processes.
    :param ndarray data:
    an ndarray of data points
    :param LOPQModel model:
    a model instance to use to compute codes
    :param int num_procs:
    the number of processes to spawn
    :returns iterable:
    an iterable of computed codes in the input order
    """
    def compute_partition(data):
        return [model.predict(d) for d in data]
    N = len(data)
    partitions = [data[a:b] for (a, b) in get_chunk_ranges(N, num_procs)]
    codes = parmap(compute_partition, partitions, num_procs)
    return chain(*codes)