code: def encode_int(v):
      
      if not is_numeric(v) or v < 0 or v >= TT256:
          raise Exception("Integer invalid or out of range: %r" % v)
      return int_to_big_endian(v)
docs: encodes an integer into serialization