def build_state_behaviour_map(self):
        """Build map with behaviours for each state."""
        ### create and alias map
        stb_map = self.state_behaviour_map = {}

        ### create and alias a behaviour map for each
        ### state

        for state_name in STATE_NAMES:

            behaviour_map = stb_map[state_name] = {}

            ## for each behaviour name, gather the
            ## corresponding behaviour for the current
            ## state and assign it to the map using
            ## the behaviour name as a key

            for behaviour_name in BEHAVIOUR_NAMES:

                ## build the behaviour name for this
                ## state
                full_behaviour_name = "_".join((state_name, behaviour_name))

                ## retrieve and store the behaviour using
                ## the name you put together; if the
                ## behaviour doesn't exist, an empty
                ## function is used instead

                behaviour_map[behaviour_name] = getattr(
                    self, full_behaviour_name, empty_function
                )
Build map with behaviours for each state.
nodezator/winman/main.py