from typing import Union
from typing import cast


def parse_bool(string: Union[str, bool]) -> bool:
    """Parse a string and return a boolean."""
    if type(string) == bool:
        return cast(bool, string)
    string = cast(str, string)
    ret = False
    if string.lower() == 'true':
        ret = True
    return ret