class_docstr: Hosts an application "instance" (an instantiated Document) for one or more connections.
  
      
class_docstr_tok: ["Hosts","an","application","``","instance","''","(","an","instantiated","Document",")","for","one","or","more","connections","."]
code: def _document_patched(self, event: DocumentPatchedEvent) -> None:
      may_suppress = event.setter is self
  
      if self._pending_writes is None:
          raise RuntimeError(
              "_pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes"
          )
  
      # TODO (havocp): our "change sync" protocol is flawed because if both
      # sides change the same attribute at the same time, they will each end
      # up with the state of the other and their final states will differ.
      for connection in self._subscribed_connections:
          if (
              may_suppress
              and connection is self._current_patch_connection
          ):
              continue
          self._pending_writes.append(
              connection.send_patch_document(event)
          )
  
imports: from __future__ import annotations
  import logging
  import inspect
  import time
  from copy import copy
  from functools import wraps
  from typing import TYPE_CHECKING, Any, Awaitable, Callable, TypeVar
  from tornado import locks
  from ..events import ConnectionLost
  from ..util.token import generate_jwt_token
  from .callbacks import DocumentCallbackGroup
label_desc: Use image node_id 20 for calling the ServerSession obj's underlying member method code with example usage: obj._document_patched(event) without return types