code: def completions_sorting_key(cls, word):
          "Fixed version of IPyton.completer.completions_sorting_key"
          prio1, prio2 = 0, 0
          if word.startswith('__'):  prio1 = 2
          elif word.startswith('_'): prio1 = 1
          if word.endswith('='):     prio1 = -1
          if word.startswith('%%'):
              if not "%" in word[2:]:
                  word = word[2:];   prio2 = 2
          elif word.startswith('%'):
              if not "%" in word[1:]:
                  word = word[1:];   prio2 = 1
          return prio1, word, priof completions_sorting_key(cls, word):
          "Fixed version of IPyton.completer.completions_sorting_key"
          prio1, prio2 = 0, 0
          if word.startswith('__'):  prio1 = 2
          elif word.startswith('_'): prio1 = 1
          if word.endswith('='):     prio1 = -1
          if word.startswith('%%'):
              if not "%" in word[2:]:
                  word = word[2:];   prio2 = 2
          elif word.startswith('%'):
              if not "%" in word[1:]:
                  word = word[1:];   prio2 = 1
          return prio1, word, prio2
docs: Fixed version of IPyton.completer.completions_sorting_key