Actually this whole block can be replaced with `self._state.setdefault(system_id, {})` which'll set it if it doesn't exist yet. Also have a look at [collections.defaultdict](http://docs.python.org/2/library/collections.html#defaultdict-examples)