input: from Crypto.PublicKey import RSA
  
  def generate_key_pair():
      """ Generate an RSA public/private key pair and save them to files.
      >>> from unittest.mock import mock_open, patch
      >>> with patch('builtins.open', mock_open()) as mocked_file:
      ...     generate_key_pair()
      >>> assert mocked_file.call_count == 2
      >>> assert mocked_file().write.call_count == 2
      """
      key = RSA.generate(2048)
      pub_key = key.publickey().export_key().decode()
      with open('public.pem', 'w') as file:
          file.write(pub_key)
      
      priv_key = key.export_key().decode()
      with open('private.pem', 'w') as file:
          file.write(priv_key)
output:     key = RSA.generate(2048)
      pub_key = key.publickey().export_key().decode()
      with open('public.pem', 'w') as file:
          file.write(pub_key)
      
      priv_key = key.export_key().decode()
      with open('private.pem', 'w') as file:
          file.write(priv_key)