code: def generation(self):
          
          with self._lock:
              if self.state is not MemberState.STABLE:
                  return None
              return self._generation
docs: Get the current generation state if the group is stable.
  
          Returns: the current generation or None if the group is unjoined/rebalancing