def matrix(size,fn=float):
    x,y = size
    try:
        x = int(abs(x))
        y = int(abs(y))
    except:
        return []
    return list(map(lambda i: y*[fn(0)], range(x)))

def copy_multilevel_ls(ls):
    ls_copy = []
    for item in ls:
        if type(item)==type([]):
            ls_copy.append(copy_multilevel_ls(item))
        else:
            ls_copy.append(item)
    return ls_copy
        
def format_number(self,num,dig,zoom=0):
    return int((10**(dig+zoom))*num)/float(10**dig)

def format_numeric_string(self,num):
    outnum = str(num)
    if len(outnum) <= 3:
        return outnum
    for i in range(len(outnum)-3,0,-3):
        outnum = outnum[:i]+","+outnum[i:]
    return outnum

