code: def rsa_private_key_pkcs1_to_pkcs8(pkcs1_key):
      
      algorithm = RsaAlgorithmIdentifier()
      algorithm["rsaEncryption"] = RSA_ENCRYPTION_ASN1_OID
  
      pkcs8_key = PKCS8PrivateKey()
      pkcs8_key["version"] = 0
      pkcs8_key["privateKeyAlgorithm"] = algorithm
      pkcs8_key["privateKey"] = pkcs1_key
  
      return encoder.encode(pkcs8_key)
docs: Convert a PKCS1-encoded RSA private key to PKCS8.