def complete_token_filtered(aliases, prefix, expanded):
complete_ary = list(aliases.keys())<EOL>results = [cmd for cmd in<EOL>complete_ary if cmd.startswith(prefix)] and not (<EOL>cmd in aliases and expanded not in aliases[cmd])<EOL>return sorted(results, key=lambda pair: pair[<NUM_LIT:0>])<EOL>
Find all starting matches in dictionary *aliases* that start
    with *prefix*, but filter out any matches already in
    *expanded*.