code: def set_affiliation(self, mucjid, jid, affiliation, *, reason=None):
          
  
          if mucjid is None or not mucjid.is_bare:
              raise ValueError("mucjid must be bare JID")
  
          if jid is None:
              raise ValueError("jid must not be None")
  
          if affiliation is None:
              raise ValueError("affiliation must not be None")
  
          iq = aioxmpp.stanza.IQ(
              type_=aioxmpp.structs.IQType.SET,
              to=mucjid
          )
  
          iq.payload = muc_xso.AdminQuery(
              items=[
                  muc_xso.AdminItem(jid=jid,
                                    reason=reason,
                                    affiliation=affiliation)
              ]
          )
  
          yield from self.client.send(iq)
docs: Change the affiliation of an entity with a MUC.
  
          :param mucjid: The bare JID identifying the MUC.
          :type mucjid: :class:`~aioxmpp.JID`
          :param jid: The bare JID of the entity whose affiliation shall be
              changed.
          :type jid: :class:`~aioxmpp.JID`
          :param affiliation: The new affiliation for the entity.
          :type affiliation: :class:`str`
          :param reason: Optional reason for the affiliation change.
          :type reason: :class:`str` or :data:`None`
  
          Change the affiliation of the given `jid` with the MUC identified by
          the bare `mucjid` to the given new `affiliation`. Optionally, a
          `reason` can be given.
  
          If you are joined in the MUC, :meth:`Room.muc_set_affiliation` may be
          more convenient, but it is possible to modify the affiliations of a MUC
          without being joined, given sufficient privilegues.
  
          Setting the different affiliations require different privilegues of the
          local user. The details can be checked in :xep:`0045` and are enforced
          solely by the server, not local code.
  
          The coroutine returns when the change in affiliation has been
          acknowledged by the server. If the server returns an error, an
          appropriate :class:`aioxmpp.errors.XMPPError` subclass is raised.