converts a bytes to human-readable format

def hsize(bytes):
    """converts a bytes to human-readable format"""
    sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
    if bytes == 0:
        return '0 Byte'
    i = int(math.floor(math.log(bytes) / math.log(1024)))
    r = round(bytes / math.pow(1024, i), 2)
    return str(r) + '' + sizes[i]