code: def import_from_pem(self, data, password=None):
          
  
          try:
              key = serialization.load_pem_private_key(
                  data, password=password, backend=default_backend())
          except ValueError as e:
              if password is not None:
                  raise e
              try:
                  key = serialization.load_pem_public_key(
                      data, backend=default_backend())
              except ValueError:
                  try:
                      cert = x509.load_pem_x509_certificate(
                          data, backend=default_backend())
                      key = cert.public_key()
                  except ValueError:
                      raise e
  
          self.import_from_pyca(key)
          self._params['kid'] = self.thumbprint()
docs: Imports a key from data loaded from a PEM file.
          The key may be encrypted with a password.
          Private keys (PKCS#8 format), public keys, and X509 certificate's
          public keys can be imported with this interface.
  
          :param data(bytes): The data contained in a PEM file.
          :param password(bytes): An optional password to unwrap the key.