def format_bytes(size):
    # type: (int) -> str
    """
    Given a size in bytes, return a sort string representation.
    """
    kbytes = size // 1024
    mbytes = kbytes // 1024
    gbytes = mbytes // 1024
    if gbytes:
        return "%s %s" % (gbytes, "GB")
    elif mbytes:
        return "%s %s" % (mbytes, "MB")
    elif kbytes:
        return "%s %s" % (kbytes, "KB")
    else:
        return "%s %s" % (size, "bytes")