code: def detect_language(prompt, supported_languages, verbose=False):
      if not have_langid:
          # if no package, just return english
          return "en"
  
      import langid
  
      # Fast language autodetection
      if len(prompt) > 15:
          language_predicted = langid.classify(prompt)[
              0
          ].strip()  # strip need as there is space at end!
          if language_predicted == "zh":
              # we use zh-cn on xtts
              language_predicted = "zh-cn"
  
          if language_predicted not in supported_languages:
              print(
                  f"Detected a language not supported by xtts :{language_predicted}, switching to english for now"
              )
              language = "en"
          else:
              language = language_predicted
          if verbose:
              print(
                  f"Language: Predicted sentence language:{language_predicted} , using language for xtts:{language}"
              )
      else:
          # Hard to detect language fast in short sentence, use english default
          language = "en"
          if verbose:
              print(
                  f"Language: Prompt is short or autodetect language disabled using english for xtts"
              )
  
      return language
  
file_path: h2ogpt/src/tts_sentence_parsing.py
imports: import textwrap
  import re
  from src.utils import flatten_list, have_emoji, have_langid
label_desc: Use image node_id 9 for calling a global function with example usage: detect_language(prompt, supported_languages, verbose) and returns: language, str