Validates a non-required language code value using IsValidLanguageCode():
    - if invalid adds InvalidValue error (if problems accumulator is provided)
    - an empty language code is regarded as valid! Otherwise we might end up
      with many duplicate errors because of the required field checks.

def ValidateLanguageCode(lang, column_name=None, problems=None):
  """
  Validates a non-required language code value using IsValidLanguageCode():
    - if invalid adds InvalidValue error (if problems accumulator is provided)
    - an empty language code is regarded as valid! Otherwise we might end up
      with many duplicate errors because of the required field checks.
  """
  if IsEmpty(lang) or IsValidLanguageCode(lang):
    return True
  else:
    if problems:
      problems.InvalidValue(column_name, lang)
    return False