import math


def format_memory_size(bytes):
    """Return a humanly readable formatting of 'bytes' using powers of 1024.
    """
    units = ('Bytes', 'KB', 'MB', 'GB', 'TB')
    if bytes < 1024:
        return '%d %s' % (bytes, units[0])
    else:
        scale = min(math.floor(math.log(bytes, 1024)), len(units)-1)
        return "%.2f %s" % (bytes / math.pow(1024, scale), units[scale])