def optimize(self, sensor_graph, model):
        """Optimize a sensor graph by running optimization passes.

        The passes are run one at a time and modify the sensor graph
        for future passes.

        Args:
            sensor_graph (SensorGraph): The graph to be optimized
            model (DeviceModel): The device that we are optimizing
                for, that OptimizationPass objects are free to use
                to guide their optimizations.
        """

        passes = self._order_pases(self._known_passes.keys())

        for opt_name in passes:
            rerun = True
            pass_instance = self._known_passes[opt_name][0]()

            while rerun:
                rerun = pass_instance.run(sensor_graph, model=model)
Optimize a sensor graph by running optimization passes.

        The passes are run one at a time and modify the sensor graph
        for future passes.

        Args:
            sensor_graph (SensorGraph): The graph to be optimized
            model (DeviceModel): The device that we are optimizing
                for, that OptimizationPass objects are free to use
                to guide their optimizations.