input: Write a function to translate a text from English to French using Python.
  
  from googletrans import Translator
  
  def translate_to_french(text):
      translator = Translator()
      translation = translator.translate(text, dest='fr')
      return translation.text
  
  assert translate_to_french("Hello, this is a sample text to translate.") == "Bonjour, ceci est un exemple de texte à traduire."
  assert translate_to_french("I love programming.") == "J'aime programmer."
  assert translate_to_french("") == ""
  assert translate_to_french("Python is great!") == "Python est génial !"
  assert translate_to_french("Learning is fun!") == "L'apprentissage est amusant !"
output: def translate_to_french(text):
      translator = Translator()
      translation = translator.translate(text, dest='fr')
      return translation.text