'Convert byte size :attr:`bufferbytes` of a file into a size string.
.. note:: This is a `classmethod`.
:param bufferbytes: The size of a file counted in bytes.
:type bufferbytes: int
:return: A readable size string.
:rtype: str'

@classmethod
def convert_size(cls, bufferbytes):

    if (bufferbytes == 0):
        return '0    B'
    l_unit = int(math.log(bufferbytes, 1024))
    units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
    formats = ['%.2f', '%.1f', '%d']
    size = (bufferbytes / math.pow(1024, l_unit))
    l_num = int(math.log(size, 10))
    if (l_unit >= len(units)):
        l_unit = (len(units) - 1)
    if (l_num >= len(formats)):
        l_num = (len(formats) - 1)
    return (''.join([formats[l_num], '    ', units[l_unit]]) % size)
