code: def get_first_lang():
      
      request_lang = request.headers.get('Accept-Language').split(',')
      if request_lang:
          lang = locale.normalize(request_lang[0]).split('.')[0]
      else:
          lang = False
      return lang
docs: Get the first lang of Accept-Language Header.