def encode_boolean(value):
    """
    Returns 1 or 0 if the value is True or False.
    None gets interpreted as False.
    Otherwise, the original value is returned.
    """
    if value is True:
        return 1
    if value is False or value is None:
        return 0
    return value