def parse_bool(b):
    """ Useful for environment variables, intelligently converts any reasonable string to a Python bool,
    or None if it is None or empty/whitespace string."""

    if b is None:
        return None
    if b is True:
        return True
    if b is False:
        return False
    if b.strip() == "":
        return None
    b = str(b).upper()[0]
    if b in ["Y", "1", "T"]:
        return True
    if b in ["N", "0", "F"]:
        return False
    raise ValueError(b)