docs: def send_complete(self):
          """
              Verify if connection should be closed based on amount of data that was sent.
          """
          self.active = True
  
          if self.should_finish():
              self._detach()
  
              # Avoid race condition when waiting for write callback and session getting closed in between
              if not self._finished:
                  self.safe_finish()
          else:
              if self.session:
                  self.session.flush()