docs: def write_command(self, request_id, msg, docs):
          """A proxy for SocketInfo.write_command that handles event publishing.
          """
          if self.publish:
              duration = datetime.datetime.now() - self.start_time
              self._start(request_id, docs)
              start = datetime.datetime.now()
          try:
              reply = self.sock_info.write_command(request_id, msg)
              if self.publish:
                  duration = (datetime.datetime.now() - start) + duration
                  self._succeed(request_id, reply, duration)
          except OperationFailure as exc:
              if self.publish:
                  duration = (datetime.datetime.now() - start) + duration
                  self._fail(request_id, exc.details, duration)
              raise
          finally:
              self.start_time = datetime.datetime.now()
          return reply