docs: def add_scoped_variable(self, name, data_type=None, default_value=None, scoped_variable_id=None):
          """ Adds a scoped variable to the container state
  
          :param name: The name of the scoped variable
          :param data_type: An optional data type of the scoped variable
          :param default_value: An optional default value of the scoped variable
          :param scoped_variable_id: An optional scoped variable id of the
          :return: the unique id of the added scoped variable
          :raises exceptions.ValueError: if the scoped variable is not valid
          """
          if scoped_variable_id is None:
              # All data port ids have to passed to the id generation as the data port id has to be unique inside a state
              scoped_variable_id = generate_data_port_id(self.get_data_port_ids())
          self._scoped_variables[scoped_variable_id] = ScopedVariable(name, data_type, default_value,
                                                                      scoped_variable_id, self)
  
          # Check for name uniqueness
          valid, message = self._check_data_port_name(self._scoped_variables[scoped_variable_id])
          if not valid:
              self._scoped_variables[scoped_variable_id].parent = None
              del self._scoped_variables[scoped_variable_id]
              raise ValueError(message)
  
          return scoped_variable_id