def _prepare_stages(self):
        """ Prepares all stages by removing disabled stages and sorting stages
        by order """
        self.debug("Preparing stages ..")

        # Remove all disabled stages
        to_remove = []
        for stage in self.stages:
            if stage.disabled:
                to_remove.append(stage)

        for stage in to_remove:
            self.stages.remove(stage)

        self.stages.sort(key=lambda stage: self._stage_order.index(stage.stage_id))
 Prepares all stages by removing disabled stages and sorting stages
        by order 
metadrive/render_pipeline/rpcore/stage_manager.py