def keystr(ui, key):
    """associate a string to a key (username, comment)"""
    keyid, user, fingerprint = key
    comment = ui.config(b'gpg', fingerprint)
    if comment:
        return b'%s (%s)' % (user, comment)
    else:
        return user
