def human_readable_number(number, suffix=''):
    """
    Format the given number into a human-readable string.

    Code adapted from http://stackoverflow.com/a/1094933

    :param variant number: the number (int or float)
    :param string suffix: the unit of the number
    :rtype: string
    """
    for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:
        if abs(number) < 1024.0:
            return '%3.1f%s%s' % (number, unit, suffix)
        number /= 1024.0
    return '%.1f%s%s' % (number, 'Y', suffix)
