def _rewrite_if_then_else(schema):
    """
    Rewrites the "if", "then" and "else" properties by converting it into a "oneOf"
    property.
    """
    if_ = schema.get('if')
    then_ = schema.get('then')
    else_ = schema.get('else', {})
    if not (if_ and then_):
        return schema
    schema['oneOf'] = [{'allOf': [if_, then_]}, {'allOf': [{'not': if_},
        else_]}]
    del schema['if']
    del schema['then']
    del schema['else']
    return schema
