code: def find_key_by_email(self, email, secret=False):
          
          for key in self.list_keys(secret=secret):
              for uid in key['uids']:
                  if re.search(email, uid):
                      return key
          raise LookupError("GnuPG public key for email %s not found!" % email)
docs: Find user's key based on their email address.
  
          :param str email: The email address to search for.
          :param bool secret: If True, search through secret keyring.