<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_guest_access(self, allow_guests):
 """Set whether guests can join the room and return True if successful."""

        guest_access = "can_join" if allow_guests else "forbidden"
        try:
            self.client.api.set_guest_access(self.room_id, guest_access)
            self.guest_access = allow_guests
            return True
        except MatrixRequestError:
            return False