def validate_bool_maybe_none(b):
if type(b) is str:<EOL><INDENT>b = b.lower()<EOL><DEDENT>if b=='<STR_LIT:none>': return None<EOL>if b in ('<STR_LIT:t>', '<STR_LIT:y>', '<STR_LIT:yes>', '<STR_LIT>', '<STR_LIT:true>', '<STR_LIT:1>', <NUM_LIT:1>, True): return True<EOL>elif b in ('<STR_LIT:f>', '<STR_LIT:n>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:false>', '<STR_LIT:0>', <NUM_LIT:0>, False): return False<EOL>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % b)<EOL><DEDENT>
Convert b to a boolean or raise