def chunk_document_collection(seq, num):
    """
    Helper function to break a collection of N = len(seq) documents
    to num batches.
    Input:
        - seq: list,
        a list of documents
        - num: int,
        number of batches to be broken into. This will usually be
        equal to the number of cores available
    Output:
        - out: list,
        a list of lists. Each sublist contains the batch-collection
        of documents to be used.
    """
    avg = len(seq) / float(num)
    out = []
    last = 0.0

    while last < len(seq):
        out.append(seq[int(last):int(last + avg)])
        last += avg

    return out