def ValidateLanguageCode(lang, column_name=None, problems=None):
  if util.IsEmpty(lang):
    return True
  bcp47_obj = parser.ParseLanguage(str(lang.lower()))
  if not bcp47_obj.wellformed:
    if problems:
      problems.InvalidValue(column_name, lang,
                            'language code "%s" is not well-formed' %
                            lang, type=problems_class.TYPE_ERROR)
    return False
  if not bcp47_obj.valid:
    if problems:
      problems.InvalidValue(column_name, lang,
                            'language code "%s" is not valid, parses as: %s' %
                            (lang, bcp47_obj), type=problems_class.TYPE_WARNING)
    return False
  return True
Validates a non-required language code value using the pybcp47 module:
dataset/ETHPy150Open google/transitfeed/extensions/googletransit/extension_util.py/ValidateLanguageCode