code: def gpg_key_fingerprint( key_data, config_dir=None ):
      
  
      key_data = str(key_data)
  
      config_dir = get_config_dir( config_dir )
      tmpdir = make_gpg_tmphome( prefix="key_id-", config_dir=config_dir )
      gpg = gnupg.GPG( homedir=tmpdir )
      res = gpg.import_keys( key_data )
  
      try:
          assert res.count == 1, "Failed to import key"
          assert len(res.fingerprints) == 1, "Nonsensical GPG response: wrong number of fingerprints"
          fingerprint = res.fingerprints[0]
          shutil.rmtree(tmpdir)
          return fingerprint
      except AssertionError, e:
          log.exception(e)
          shutil.rmtree(tmpdir)
          return None
docs: Get the key ID of a given serialized key
      Return the fingerprint on success
      Return None on error