code: def set_user_profile(self,
                           displayname=None,
                           avatar_url=None,
                           reason="Changing room profile information"):
          
          member = self.client.api.get_membership(self.room_id, self.client.user_id)
          if member["membership"] != "join":
              raise Exception("Can't set profile if you have not joined the room.")
          if displayname is None:
              displayname = member["displayname"]
          if avatar_url is None:
              avatar_url = member["avatar_url"]
          self.client.api.set_membership(
              self.room_id,
              self.client.user_id,
              'join',
              reason, {
                  "displayname": displayname,
                  "avatar_url": avatar_url
              }
          )
docs: Set user profile within a room.
  
          This sets displayname and avatar_url for the logged in user only in a
          specific room. It does not change the user's global user profile.