input: Write a function to translate a text from English to French using the Google Translate API. The function should return the translated text. Ensure you have installed the `googletrans` library and imported the `Translator` class from it.
  assert translate_text("Hello, this is a sample text to translate.")=="Bonjour, ceci est un exemple de texte à traduire."
  assert translate_text("Python is a widely used programming language.")=="Python est un langage de programmation largement utilisé."
  assert translate_text("Machine learning is an exciting field.")=="L'apprentissage automatique est un domaine passionnant."
  assert translate_text("Data science is a multidisciplinary field.")=="La science des données est un domaine multidisciplinaire."
output: def translate_text(text):
      translator = Translator()
      translation = translator.translate(text, src='en', dest='fr')
      return translation.text