code: def encrypted_temporary_private_key(tmp_path: Path) -> Path:
      key = rsa.generate_private_key(
          backend=default_backend(),
          public_exponent=65537,
          key_size=2048,
      )
      private_key = key.private_bytes(
          serialization.Encoding.PEM,
          serialization.PrivateFormat.PKCS8,
          encryption_algorithm=serialization.BestAvailableEncryption(
              _PASSWORD.encode()
          ),
      )
      test_key_file: Path = tmp_path / "test_key.p8"
      test_key_file.write_bytes(private_key)
      return test_key_file
  
imports: from __future__ import annotations
  import json
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any
  from unittest import mock
  import pytest
  from cryptography.hazmat.backends import default_backend
  from cryptography.hazmat.primitives import serialization
  from cryptography.hazmat.primitives.asymmetric import rsa
  from airflow.models import Connection
  from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
label_desc: Use image node_id 2 for calling a global function with example usage: encrypted_temporary_private_key(tmp_path) and returns: test_key_file