code: def int_subtype(i, bits, signed) :
          "returns integer i after checking that it fits in the given number of bits."
          if not isinstance(i, int) :
              raise TypeError("value is not int: %s" % repr(i))
          #end if
          if signed :
              lo = - 1 << bits - 1
              hi = (1 << bits - 1) - 1
          else :
              lo = 0
              hi = (1 << bits) - 1
          #end if
          if i < lo or i > hi :
              raise ValueError \
                (
                  "%d not in range of %s %d-bit value" % (i, ("unsigned", "signed")[signed], bits)
                )
          #end if
          return \
              f int_subtype(i, bits, signed) :
          "returns integer i after checking that it fits in the given number of bits."
          if not isinstance(i, int) :
              raise TypeError("value is not int: %s" % repr(i))
          #end if
          if signed :
              lo = - 1 << bits - 1
              hi = (1 << bits - 1) - 1
          else :
              lo = 0
              hi = (1 << bits) - 1
          #end if
          if i < lo or i > hi :
              raise ValueError \
                (
                  "%d not in range of %s %d-bit value" % (i, ("unsigned", "signed")[signed], bits)
                )
          #end if
          return \
              i
docs: returns integer i after checking that it fits in the given number of bits.