<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _order_pases(self, passes):
 """Topologically sort optimization passes. This ensures that the resulting passes are run in order respecting before/after constraints. Args: passes (iterable):
 An iterable of pass names that should be included in the optimization passes run. """


        passes = set(passes)

        pass_deps = {}

        for opt in passes:
            _, before, after = self._known_passes[opt]

            if opt not in pass_deps:
                pass_deps[opt] = set()

            for after_pass in after:
                pass_deps[opt].add(after_pass)

            # For passes that we are before, we may need to
            # preemptively add them to the list early
            for other in before:
                if other not in passes:
                    continue

                if other not in pass_deps:
                    pass_deps[other] = set()

                pass_deps[other].add(opt)

        return toposort_flatten(pass_deps)