docs: def serialize_private_key_to_pem(private_key, passphrase_bytes=None):
      """Serialize private key to PEM.
  
      Args:
        private_key:
        passphrase_bytes:
  
      Returns:
        bytes: PEM encoded private key
  
      """
      return private_key.private_bytes(
          encoding=cryptography.hazmat.primitives.serialization.Encoding.PEM,
          format=cryptography.hazmat.primitives.serialization.PrivateFormat.TraditionalOpenSSL,
          encryption_algorithm=cryptography.hazmat.primitives.serialization.BestAvailableEncryption(
              passphrase_bytes
          )
          if passphrase_bytes is not None
          else cryptography.hazmat.primitives.serialization.NoEncryption(),
      )