code: def choose_key(gpg_private_keys):
      
  
      uid_strings_fp = []
      uid_string_fp2key = {}
  
      current_key_index = None
  
      for i, key in enumerate(gpg_private_keys):
          fingerprint = key['fingerprint']
  
          if fingerprint == config["gpg_key_fingerprint"]:
              current_key_index = i
  
          for uid_string in key['uids']:
              uid_string_fp = '"' + uid_string + ' (' + fingerprint + ')'
              uid_strings_fp.append(uid_string_fp)
              uid_string_fp2key[uid_string_fp] = key
  
      msg = _('Choose a GPG key for signing pyspread save files.\n'
              'The GPG key must not have a passphrase set.')
  
      dlg = wx.SingleChoiceDialog(None, msg, _('Choose key'), uid_strings_fp,
                                  wx.CHOICEDLG_STYLE)
  
      childlist = list(dlg.GetChildren())
      childlist[-3].SetLabel(_("Use chosen key"))
      childlist[-2].SetLabel(_("Create new key"))
  
      if current_key_index is not None:
          # Set choice to current key
          dlg.SetSelection(current_key_index)
  
      if dlg.ShowModal() == wx.ID_OK:
          uid_string_fp = dlg.GetStringSelection()
          key = uid_string_fp2key[uid_string_fp]
  
      else:
          key = None
  
      dlg.Destroy()
  
      return key
docs: Displays gpg key choice and returns key