code: def createKey(batchfile):
      
      key = gpg.gen_key(batchfile)
      fingerprint = key.fingerprint
  
      if not fingerprint:
          log.error("Key creation seems to have failed: %s" % key.status)
          return None, None
      return key, fingerprint
docs: Create a new keypair from a **batchfile**.
  
      Writes the new keys into keyrings named after ``NAME_EMAIL`` inside the
      ``NEWKEY_DIR``.
  
      :params str batchfile: A GnuPG batchfile. See :func:`createBatchfile`.