def strtobool(term, table={u'false': False, u'no': False, u'0': False, u'true': True, u'yes': True, u'1': True, u'on': True, u'off': False}):
 if isinstance(term, string_t):
  try:
   return table[term.lower()]
  except KeyError:
   raise TypeError(u'Cannot coerce {0!r} to type bool'.format(term))
 return term

def strtobool ( term , table = { u'false' : False , u'no' : False , u'0' : False , u'true' : True , u'yes' : True , u'1' : True , u'on' : True , u'off' : False } ) : if isinstance ( term , string_t ) : try : return table [ term . lower ( ) ] except KeyError : raise TypeError ( u'Cannot coerce {0!r} to type bool' . format ( term ) ) return term
convert common terms for true/false to bool .