docs: def maybe_leave_group(self):
          """Leave the current group and reset local generation/memberId."""
          with self._client._lock, self._lock:
              if (not self.coordinator_unknown()
                  and self.state is not MemberState.UNJOINED
                  and self._generation is not Generation.NO_GENERATION):
  
                  # this is a minimal effort attempt to leave the group. we do not
                  # attempt any resending if the request fails or times out.
                  log.info('Leaving consumer group (%s).', self.group_id)
                  version = 0 if self.config['api_version'] < (0, 11, 0) else 1
                  request = LeaveGroupRequest[version](self.group_id, self._generation.member_id)
                  future = self._client.send(self.coordinator_id, request)
                  future.add_callback(self._handle_leave_group_response)
                  future.add_errback(log.error, "LeaveGroup request failed: %s")
                  self._client.poll(future=future)
  
              self.reset_generation()