code: def write(self, data: bytes) -> int:
          
          if self._sock is None:
              raise IOError('Internal socket set to None; cannot perform handshake.')
          if not self._is_handshake_completed:
              raise IOError('SSL Handshake was not completed; cannot send data.')
  
          # Pass the cleartext data to the SSL engine
          self._ssl.write(data)
  
          # Recover the corresponding encrypted data
          final_length = self._flush_ssl_engine()
  
          return final_length
docs: Returns the number of (encrypted) bytes sent.