def suggestions(matches, command):
 for m in matches:
  if (('name' in m) and ('suggestions' in m)):
   before = command[:m['start']]
   after = command[m['end']:]
   newsuggestions = []
   for othermp in sorted(m['suggestions'], key=(lambda mp: mp.section)):
    mid = ('%s.%s' % (othermp.name, othermp.section))
    newsuggestions.append({'cmd': ''.join([before, mid, after]), 'text': othermp.namesection})
   m['suggestions'] = newsuggestions

def suggestions ( matches , command ) : for m in matches : if ( ( 'name' in m ) and ( 'suggestions' in m ) ) : before = command [ : m [ 'start' ] ] after = command [ m [ 'end' ] : ] newsuggestions = [ ] for othermp in sorted ( m [ 'suggestions' ] , key = ( lambda mp : mp . section ) ) : mid = ( '%s.%s' % ( othermp . name , othermp . section ) ) newsuggestions . append ( { 'cmd' : '' . join ( [ before , mid , after ] ) , 'text' : othermp . namesection } ) m [ 'suggestions' ] = newsuggestions
enrich command matches with links to other man pages with the same name .