code: def get_privatekey(keydata):
      
      key = serialization.load_pem_private_key(
          keydata,
          password=None,
          backend=default_backend(),
      )
      return key
docs: Load the private key from a PEM encoded string.