<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nice_number(number, thousands_separator=',', max_ndigits_after_dot=None):
 """Return nicely printed number NUMBER in language LN. Return nicely printed number NUMBER in language LN using given THOUSANDS_SEPARATOR character. If max_ndigits_after_dot is specified and the number is float, the number is rounded by taking in consideration up to max_ndigits_after_dot digit after the dot. This version does not pay attention to locale. See tmpl_nice_number_via_locale(). """

    if isinstance(number, float):
        if max_ndigits_after_dot is not None:
            number = round(number, max_ndigits_after_dot)
        int_part, frac_part = str(number).split('.')
        return '%s.%s' % (nice_number(int(int_part), thousands_separator),
                          frac_part)
    else:
        chars_in = list(str(number))
        number = len(chars_in)
        chars_out = []
        for i in range(0, number):
            if i % 3 == 0 and i != 0:
                chars_out.append(thousands_separator)
            chars_out.append(chars_in[number - i - 1])
        chars_out.reverse()
        return ''.join(chars_out)