code: def sort_completions(completions_gen):
      
      from knack.help import REQUIRED_TAG
  
      def _get_weight(val):
          """ weights the completions with required things first the lexicographically"""
          priority = ''
          if val.display_meta and val.display_meta.startswith(REQUIRED_TAG):
              priority = ' '  # a space has the lowest ordinance
          return priority + val.text
  
      return sorted(completions_gen, key=_get_weight)
docs: sorts the completions