def pretty_byte_count(num):
    """Converts integer into a human friendly count of bytes, eg: 12.243 MB"""
    if num == 1:
        return '1 byte'
    elif num < 1024:
        return '%s bytes' % num
    elif num < 1048576:
        return '%.2f KB' % (num / 1024.0)
    elif num < 1073741824:
        return '%.3f MB' % (num / 1048576.0)
    elif num < 1099511627776:
        return '%.3f GB' % (num / 1073741824.0)
    else:
        return '%.3f TB' % (num / 1099511627776.0)
