<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_query_kwargs(kwargs, visitor, constraints, index):
 """ Construct KeyConditionExpression and FilterExpression """

    (query_const, filter_const) = constraints.remove_index(index)
    kwargs["key_condition_expr"] = query_const.build(visitor)
    if filter_const:
        kwargs["filter"] = filter_const.build(visitor)
    if index.name != "TABLE":
        kwargs["index"] = index.name