code: def scripts_in_preferred_order(self):
      if self.scripts is None:
          import modules.scripts
  
          self.initialize_scripts(
              modules.scripts.postprocessing_scripts_data
          )
  
      scripts_order = shared.opts.postprocessing_operation_order
  
      def script_score(name):
          for i, possible_match in enumerate(scripts_order):
              if possible_match == name:
                  return i
  
          return len(self.scripts)
  
      script_scores = {
          script.name: (
              script_score(script.name),
              script.order,
              script.name,
              original_index,
          )
          for original_index, script in enumerate(self.scripts)
      }
  
      return sorted(self.scripts, key=lambda x: script_scores[x.name])
  
imports: import dataclasses
  import os
  import gradio
  from modules import errors, shared
label_desc: Use image node_id 4 for calling the ScriptPostprocessingRunner obj's underlying member method code with example usage: obj.scripts_in_preferred_order() and returns: sorted, len, i