def size_to_str(size):
    """Returns printable string representation of a file's size."""
    units = ['bytes', 'kB', 'MB', 'GB', 'TB']
    ix = 0
    is_int = True
    
    while size > 1024:
        is_int = False
        size = float(size)/1024
        ix = ix + 1
    
    if is_int:
        return "{0:>4} {1}".format(size, units[ix])
    else:
        return "{0:>4.2f} {1}".format(size, units[ix])