code: def _str_to_bool(str_):
      
      if str_.lower() not in ['true', 'false', 'none']:
          raise ValueError('Need bool; got %r' % str_)
      return {'true': True, 'false': False, 'none': None}[str_.lower()]
docs: Convert string to bool (in argparse context).