def itn(n, digits=<NUM_LIT:8>, format=DEFAULT_FORMAT):
<EOL>if <NUM_LIT:0> <= n < <NUM_LIT:8> ** (digits - <NUM_LIT:1>):<EOL><INDENT>s = ("<STR_LIT>" % (digits - <NUM_LIT:1>, n)).encode("<STR_LIT:ascii>") + NUL<EOL><DEDENT>else:<EOL><INDENT>if format != GNU_FORMAT or n >= <NUM_LIT> ** (digits - <NUM_LIT:1>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if n < <NUM_LIT:0>:<EOL><INDENT>n = struct.unpack("<STR_LIT:L>", struct.pack("<STR_LIT:l>", n))[<NUM_LIT:0>]<EOL><DEDENT>s = bytearray()<EOL>for i in range(digits - <NUM_LIT:1>):<EOL><INDENT>s.insert(<NUM_LIT:0>, n & <NUM_LIT>)<EOL>n >>= <NUM_LIT:8><EOL><DEDENT>s.insert(<NUM_LIT:0>, <NUM_LIT>)<EOL><DEDENT>return s<EOL>
Convert a python number to a number field.