'>>> g = GnuPG(None)
>>> g.list_keys()[0]
0'

def list_keys(self, selectors=None):

    list_keys = ['--fingerprint']
    for sel in set((selectors or [])):
        list_keys += ['--list-keys', sel]
    if (not selectors):
        list_keys += ['--list-keys']
    self.event.running_gpg((_('Fetching    GnuPG    public    key    list    (selectors=%s)') % ',    '.join((selectors or []))))
    retvals = self.run(list_keys)
    return self.parse_keylist(retvals[1]['stdout'])
