def autoset_id(self):
        """
        If the :attr:`id_` already has a non-false (false is also the empty
        string!) value, this method is a no-op.

        Otherwise, the :attr:`id_` attribute is filled with
        :data:`RANDOM_ID_BYTES` of random data, encoded by
        :func:`aioxmpp.utils.to_nmtoken`.

        .. note::

           This method only works on subclasses of :class:`StanzaBase` which
           define the :attr:`id_` attribute.
        """
        try:
            self.id_
        except AttributeError:
            pass
        else:
            if self.id_:
                return

        self.id_ = to_nmtoken(random.getrandbits(8*RANDOM_ID_BYTES))