<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_boolean_envvar(val):
 """Parse a boolean environment variable."""

    if not val or val.lower() in {'false', '0'}:
        return False
    elif val.lower() in {'true', '1'}:
        return True
    else:
        raise ValueError('Invalid boolean environment variable: %s' % val)