def writecc (listoflists,file,writetype='w',extra=2):
    if type(listoflists[0]) not in [ListType,TupleType]:
        listoflists = [listoflists]
    outfile = open(file,writetype)
    rowstokill = []
    list2print = copy.deepcopy(listoflists)
    for i in range(len(listoflists)):
        if listoflists[i] == ['\n'] or listoflists[i]=='\n' or listoflists[i]=='dashes':
            rowstokill = rowstokill + [i]
    rowstokill.reverse()
    for row in rowstokill:
        del list2print[row]
    maxsize = [0]*len(list2print[0])
    for col in range(len(list2print[0])):
        items = pstats.colex(list2print,col)
        items = map(pstats.makestr,items)
        maxsize[col] = max(map(len,items)) + extra
    for row in listoflists:
        if row == ['\n'] or row == '\n':
            outfile.write('\n')
        elif row == ['dashes'] or row == 'dashes':
            dashes = [0]*len(maxsize)
            for j in range(len(maxsize)):
                dashes[j] = '-'*(maxsize[j]-2)
            outfile.write(pstats.lineincustcols(dashes,maxsize))
        else:
            outfile.write(pstats.lineincustcols(row,maxsize))
        outfile.write('\n')
    outfile.close()
    return None
Writes a list of lists to a file in columns, customized by the max
dataset/ETHPy150Open radlab/sparrow/src/main/python/third_party/stats.py/writecc