def _CheckLanguage(language):
 if (language is None):
  return None
 if (not isinstance(language, basestring)):
  raise TypeError(('language must be a basestring, got %s' % language.__class__.__name__))
 if (not re.match(_LANGUAGE_RE, language)):
  raise ValueError(('invalid language %s. Languages should be two letters.' % language))
 return language

def _CheckLanguage ( language ) : if ( language is None ) : return None if ( not isinstance ( language , basestring ) ) : raise TypeError ( ( 'language must be a basestring, got %s' % language . __class__ . __name__ ) ) if ( not re . match ( _LANGUAGE_RE , language ) ) : raise ValueError ( ( 'invalid language %s. Languages should be two letters.' % language ) ) return language
checks language is none or a string that matches _language_re .