docs: def related_linkage_state(self, state_id):
          """ TODO: document
          """
  
          related_transitions = {'external': {'ingoing': [], 'outgoing': []},
                                 'internal': {'enclosed': [], 'ingoing': [], 'outgoing': []}}
          related_data_flows = {'external': {'ingoing': [], 'outgoing': []},
                                'internal': {'enclosed': [], 'ingoing': [], 'outgoing': []}}
          # ingoing logical linkage to rebuild
          related_transitions['external']['ingoing'] = [t for t in self.transitions.values() if t.to_state == state_id]
          # outgoing logical linkage to rebuild
          related_transitions['external']['outgoing'] = [t for t in self.transitions.values() if t.from_state == state_id]
          # ingoing data linkage to rebuild
          related_data_flows['external']['ingoing'] = [df for df in self.data_flows.values() if df.to_state == state_id]
          # outgoing outgoing linkage to rebuild
          related_data_flows['external']['outgoing'] = [df for df in self.data_flows.values() if df.from_state == state_id]
  
          state = self.states[state_id]
          if not isinstance(state, ContainerState):
              return related_transitions, related_data_flows
  
          for t_id, t in state.transitions.items():
              # check if internal of new hierarchy state
              if t.from_state in state.states and t.to_state in state.states:
                  related_transitions['internal']['enclosed'].append(t)
              elif t.to_state in state.states:
                  related_transitions['internal']['ingoing'].append(t)
              elif t.from_state in state.states:
                  related_transitions['internal']['outgoing'].append(t)
              else:
                  raise AttributeError("All transition have to be ingoing, outgoing or internal.")
  
          for df_id, df in state.data_flows.items():
              # check if internal of hierarchy state
              if df.from_state in state.states and df.to_state in state.states or \
                      df.from_state in state.states and state.state_id == df.to_state and df.to_key in state.scoped_variables or \
                      state.state_id == df.from_state and df.from_key in state.scoped_variables and df.to_state in state.states:
                  related_data_flows['internal']['enclosed'].append(df)
              elif df.to_state in state.states or \
                      state.state_id == df.to_state and df.to_key in state.scoped_variables or \
                      df.to_state == df.from_state and df.from_key in state.input_data_ports:
                  related_data_flows['internal']['ingoing'].append(df)
              elif df.from_state in state.states or \
                      state.state_id == df.from_state and df.from_key in state.scoped_variables or \
                      df.to_state == df.from_state and df.to_key in state.output_data_ports:
                  related_data_flows['internal']['outgoing'].append(df)
              else:
                  raise AttributeError("All data flow have to be ingoing, outgoing or internal.")
  
          return related_transitions, related_data_flows