def fmt_size(size):
    """Convert byte size to a more readable format (mb, etc.)."""

    unit, units = ' b', ['gb', 'mb', 'kb']
    while size > 1024 and units:
        size /= 1024.0
        unit = units.pop()
    return '{} {}'.format(round(size, 2), unit)