docs: def states(self, states):
          """ Setter for _states field
  
          See property
  
          :param states: Dictionary of States
          :raises exceptions.TypeError: if the states parameter is of wrong type
          :raises exceptions.AttributeError: if the keys of the dictionary and the state_ids in the dictionary do not match
          """
          if not isinstance(states, dict):
              raise TypeError("states must be of type dict")
          if [state_id for state_id, state in states.items() if not isinstance(state, State)]:
              raise TypeError("element of container_state.states must be of type State")
          if [state_id for state_id, state in states.items() if not state_id == state.state_id]:
              raise AttributeError("The key of the state dictionary and the id of the state do not match")
  
          old_states = self._states
          self._states = states
          for state_id, state in states.items():
              try:
                  state.parent = self
              except ValueError:
                  self._states = old_states
                  raise
  
          # check that all old_states are no more referencing self as there parent
          for old_state in old_states.values():
              if old_state not in self._states.values() and old_state.parent is self:
                  old_state.parent = None