def to_boolean(obj) ->bool:
    """
    Convert any of the common wire representations of a ``bool`` to a ``bool``.
    """
    if obj is None:
        return None
    if isinstance(obj, bool):
        return obj
    elif isinstance(obj, str):
        lobj = obj.lower().strip()
        if lobj == 'true':
            return True
        elif lobj == 'false':
            return False
        else:
            raise ValueError(f'Could not parse a string as a boolean: {obj!r}')
    raise ValueError(f'Could not parse as a boolean: {obj!r}')
