code: def rsa_private_key_pkcs8_to_pkcs1(pkcs8_key):
      
      decoded_values = decoder.decode(pkcs8_key, asn1Spec=PKCS8PrivateKey())
  
      try:
          decoded_key = decoded_values[0]
      except IndexError:
          raise ValueError("Invalid private key encoding")
  
      return decoded_key["privateKey"]
docs: Convert a PKCS8-encoded RSA private key to PKCS1.