docs: def _setuint(self, uint, length=None):
          """Reset the bitstring to have given unsigned int interpretation."""
          try:
              if length is None:
                  # Use the whole length. Deliberately not using .len here.
                  length = self._datastore.bitlength
          except AttributeError:
              # bitstring doesn't have a _datastore as it hasn't been created!
              pass
          # TODO: All this checking code should be hoisted out of here!
          if length is None or length == 0:
              raise CreationError("A non-zero length must be specified with a "
                                  "uint initialiser.")
          if uint >= (1 << length):
              msg = "{0} is too large an unsigned integer for a bitstring of length {1}. "\
                    "The allowed range is [0, {2}]."
              raise CreationError(msg, uint, length, (1 << length) - 1)
          if uint < 0:
              raise CreationError("uint cannot be initialsed by a negative number.")
          s = hex(uint)[2:]
          s = s.rstrip('L')
          if len(s) & 1:
              s = '0' + s
          try:
              data = bytes.fromhex(s)
          except AttributeError:
              # the Python 2.x way
              data = binascii.unhexlify(s)
          # Now add bytes as needed to get the right length.
          extrabytes = ((length + 7) // 8) - len(data)
          if extrabytes > 0:
              data = b'\x00' * extrabytes + data
          offset = 8 - (length % 8)
          if offset == 8:
              offset = 0
          self._setbytes_unsafe(bytearray(data), length, offset)