input: Write a function to generate an RSA public/private key pair and save them to files named 'public.pem' and 'private.pem'. If successful, the function should return True, otherwise False.
  from Crypto.PublicKey import RSA
  
  def generate_key_pair():
   try:
    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)
    return True
   except Exception as e:
    return False
  
  assert generate_key_pair()==True
output: 
  def generate_key_pair():
   try:
    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)
    return True
   except Exception as e:
    return False
  