def Boolean():
@wraps(Boolean)<EOL>def built(value):<EOL><INDENT>if isinstance(value, bool):<EOL><INDENT>return value<EOL><DEDENT>if value == None:<EOL><INDENT>return False<EOL><DEDENT>if isinstance(value, int):<EOL><INDENT>return not value == <NUM_LIT:0><EOL><DEDENT>if isinstance(value, str):<EOL><INDENT>if value.lower() in { '<STR_LIT:y>', '<STR_LIT:yes>', '<STR_LIT:t>', '<STR_LIT:true>' }:<EOL><INDENT>return True<EOL><DEDENT>elif value.lower() in { '<STR_LIT:n>', '<STR_LIT>', '<STR_LIT:f>', '<STR_LIT:false>' }:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>raise Error("<STR_LIT>")<EOL><DEDENT>return built<EOL>
Creates a validator that attempts to convert the given value to a boolean
or raises an error. The following rules are used:

``None`` is converted to ``False``.

``int`` values are ``True`` except for ``0``.

``str`` values converted in lower- and uppercase:

* ``y, yes, t, true``
* ``n, no, f, false``