def str2bool(v):
    """Decoding string-encoded bool into Python objects.
    This function returns one of the following:
    * True if value decodes to true,
    * False if value decodes to false,
    * None otherwise.

    Based on: https://stackoverflow.com/a/715468"""
    value = str(v).lower()
    if value in ("yes", "true", "t", "1"):
        return True
    elif value in ("no", "false", "f", "0"):
        return False
    else:
        return None