code: def is_serving(self) -> bool:
          
          try:
              # Python ≥ 3.7
              return self.server.is_serving()  # type: ignore
          except AttributeError:  # pragma: no cover
              # Python < 3.7
              return self.server.sockets is not None
docs: Tell whether the server is accepting new connections or shutting down.