import math


def format_count(number, maxlen=3):
    """
    Returns a formatted count number,
    e.g. "1.3K" if number is longer than allowed maximum.
    """
    result = str(number)
    if len(result) > maxlen:
        UNITS = "KMGTPEZY"
        log = min(len(UNITS) - 1, math.floor(math.log(number, 1000)))
        result = "%.*f" % (1, number / math.pow(1000, log))
        result = result.rstrip("0").rstrip(".")
        if len(result) > maxlen and "." in result:
            log += 1
            result = "%.*f" % (1, number / math.pow(1000, log))
            result = result.rstrip("0").rstrip(".")
        result += UNITS[int(log) - 1]
    return result