def IsValidLanguageCode(lang):
  bcp47_obj = parser.ParseLanguage(str(lang.lower()))
  return bcp47_obj.IsWellformed() and bcp47_obj.IsValid()
Checks the validity of a language code value:
dataset/ETHPy150Open google/transitfeed/extensions/googletransit/extension_util.py/IsValidLanguageCode