code: def write(self, data):
          
          # If nobody is connected, act like all data was written anyway.
          if self.connected is None:
              return 0
          data = to_bytes_safe(data)
          size = len(data)
          remaining = size
          while remaining:
              count = self._abstract_socket.write(data)
              remaining -= count
              if remaining:
                  data = data[count:]
          return size
docs: ! @brief Write bytes into the connection.