'Return completion info for all top-level names matching the
given prefix and ilk in all blobs in this lib.
"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.
"ctlr" (optional) is an EvalController instance. If
specified it should be used in the normal way (logging,
checking .is_aborted()).
Returns a list of 2-tuples: (<ilk>, <name>).
Note: the list is not sorted, because often some special sorting
is required for the different completion evaluators that might use
this API.'

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

    cplns = []
    if (prefix is None):
        for (i, bft) in self.toplevelname_index.iteritems():
            if ((ilk is not None) and (i != ilk)):
                continue
            cplns += [(i, toplevelname) for toplevelname in bft]
    elif (ilk is not None):
        try:
            toplevelnames = self.toplevelprefix_index[ilk][prefix]
        except KeyError:
            pass
        else:
            cplns += [(ilk, t) for t in toplevelnames]
    else:
        for (i, tfp) in self.toplevelprefix_index.iteritems():
            if (prefix not in tfp):
                continue
            cplns += [(i, t) for t in tfp[prefix]]
    return cplns
