def _smart_round(figure, width=<NUM_LIT:10>, max_decimal=<NUM_LIT:4>):
n_digits = len(str(int(figure)))<EOL>n_decimal = width - (n_digits + <NUM_LIT:1>)<EOL>if n_decimal <= <NUM_LIT:1>:<EOL><INDENT>return str(int(figure))<EOL><DEDENT>else:<EOL><INDENT>n_decimal = min(n_decimal, max_decimal)<EOL>format_str = "<STR_LIT>" + str(n_decimal) + "<STR_LIT:f>"<EOL>return format_str % figure<EOL><DEDENT>
Round large numbers as integers, smaller numbers as decimals.