<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nexus(network, before_state, after_state, direction=Direction.BIDIRECTIONAL):
 """Return a tuple of all irreducible nexus of the network."""

    validate.is_network(network)

    sias = (sia(transition, direction) for transition in
            transitions(network, before_state, after_state))
    return tuple(sorted(filter(None, sias), reverse=True))