import copy


def chunk_table(table, chunksize=10):
    """
    Separates the table into multiprocessing chunks

    Parameters
    ----------
    table : astropy.table
        Full table object
    chunksize : int, optional
        Default size of chunks is 10

    Returns
    -------
    result : list

    """
    remaining = 1
    result = []
    while remaining > 0:
        try:
            res = copy.deepcopy(table[:chunksize])
            table = table[chunksize:]
            # save_asc.write(table, listname, overwrite=True)
            remaining = len(table)
        except IndexError:
            res = copy.deepcopy(table)
            remaining = 0
        result.append(res)
    return result