<s> _state_strings = dict ( <EOL> allow = True , deny = False , <EOL> grant = True , reject = False , <EOL> ) <EOL> def parse_state ( state ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( state , bool ) : <EOL> return state <EOL> if not isinstance ( state , basestring ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> try : <EOL> return _state_strings [ state . lower ( ) ] <EOL> except KeyError : <EOL> raise ValueError ( '<STR_LIT>' ) </s>
