def bool_assignment(arg, patterns=None):
arg = str(arg)    <EOL>try:<EOL><INDENT>if patterns is None:<EOL><INDENT>patterns = (<EOL>(re.compile(r'<STR_LIT>', flags=re.IGNORECASE), lambda x: x.lower() == '<STR_LIT:true>'),<EOL>(re.compile(r'<STR_LIT>', flags=re.IGNORECASE), lambda x: x.lower() == '<STR_LIT:yes>'),<EOL>(re.compile(r'<STR_LIT>', flags=re.IGNORECASE), lambda x: x.lower() == '<STR_LIT:y>')<EOL>)<EOL><DEDENT>if not arg:<EOL><INDENT>return '<STR_LIT>'    <EOL><DEDENT>else:<EOL><INDENT>for pattern, func in patterns:<EOL><INDENT>if pattern.match(arg):<EOL><INDENT>return func(arg)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>raise e<EOL><DEDENT>
Summary:
    Enforces correct bool argment assignment
Arg:
    :arg (*): arg which must be interpreted as either bool True or False
Returns:
    bool assignment | TYPE:  bool