def red(text):
return codes["red"]+text+codes["reset"]
def humansize(size):
"Converts size into a string with a human readable size. Ie converts 1024 to 1KB etc."
sizes=["B","KB","MB","GB"]
i = 0;
fsize=float(size)
while(fsize > 1024):
i+=1
fsize /= 1024
return ("%.1f" % fsize) + sizes[i]