code: def add_validation_phase(phase, before=None, after=None):
      
      idx = 0
      for x in _validation_phases:
          if x == before:
              _validation_phases.insert(idx, phase)
              return
          elif x == after:
              _validation_phases.insert(idx+1, phase)
              return
          idx = idx + 1
      # otherwise append at the end
      _validation_phases.append(phase)
docs: Add a validation phase to the framework.
  
      Can be used by plugins to do special validation of extensions.