'Return completion info for all top-level names matching the
given prefix and ilk.
"prefix" is a 3-character prefix with which to filter top-level
names. If None (or not specified), results are not filtered
based on the prefix.
"ilk" is a symbol type (e.g. "class", "variable", "function")
with which to filter results. If None (or not specified),
results of any ilk are returned.
Returns a list of 2-tuples: (<ilk>, <name>).'

def toplevel_cplns(self, prefix=None, ilk=None):

    self.merge_expired(time.time())
    cplns = []
    for (base, (timestamp, res_data, res_data_pivot)) in self._on_deck.items():
        if (res_data_pivot is None):
            res_data_pivot = self._on_deck[base][2] = self._pivot_res_data(res_data)
        if (ilk is None):
            for (i, bft) in res_data_pivot.iteritems():
                cplns += [(i, toplevelname) for toplevelname in bft]
        elif (ilk in res_data_pivot):
            cplns += [(ilk, toplevelname) for toplevelname in res_data_pivot[ilk]]
    if (ilk is None):
        for (i, bft) in self._data.iteritems():
            cplns += [(i, toplevelname) for toplevelname in bft]
    elif (ilk in self._data):
        cplns += [(ilk, toplevelname) for toplevelname in self._data[ilk]]
    if (prefix is not None):
        cplns = [(i, t) for (i, t) in cplns if t.startswith(prefix)]
    return cplns
