def sizeFormat(sizeInBytes):
    """
    Format a number of bytes (int) into the right unit for human readable
    display.
    """
    size = float(sizeInBytes)
    if sizeInBytes < 1024:
        return "%.0fB" % (size)
    if sizeInBytes < 1024 ** 2:
        return "%.3fKb" % (size / 1024)
    if sizeInBytes < 1024 ** 3:
        return "%.3fMb" % (size / (1024 ** 2))
    else:
        return "%.3fGb" % (size / (1024 ** 3))