docs: def events(network, previous_state, current_state, next_state, nodes,
             mechanisms=False):
      """Find all events (mechanisms with actual causes and actual effects)."""
      actual_causes = _actual_causes(network, previous_state, current_state,
                                     nodes, mechanisms)
      actual_effects = _actual_effects(network, current_state, next_state,
                                       nodes, mechanisms)
      actual_mechanisms = (set(c.mechanism for c in actual_causes) &
                           set(c.mechanism for c in actual_effects))
  
      if not actual_mechanisms:
          return ()
  
      def index(actual_causes_or_effects):
          """Filter out unidirectional occurences and return a dictionary keyed
          by the mechanism of the cause or effect.
          """
          return {o.mechanism: o for o in actual_causes_or_effects
                  if o.mechanism in actual_mechanisms}
  
      actual_causes = index(actual_causes)
      actual_effects = index(actual_effects)
  
      return tuple(Event(actual_causes[m], actual_effects[m])
                   for m in sorted(actual_mechanisms))