def METHOD_NAME(obj, history_table):
    query = get_input_dict()
    where = [False, False]
    where = [getattr(history_table, f) == query.get(f) for f in query]
    where.append(history_table.data_version != null())
    if hasattr(history_table, "product"):
        where.append(history_table.product != null())
        if request.args.get("product"):
            where.append(history_table.product == request.args.get("product"))
    if hasattr(history_table, "channel"):
        where.append(history_table.channel != null())
        if request.args.get("channel"):
            where.append(history_table.channel == request.args.get("channel"))
    if request.args.get("timestamp_from"):
        where.append(history_table.timestamp >= int(request.args.get("timestamp_from")))
    if request.args.get("timestamp_to"):
        where.append(history_table.timestamp <= int(request.args.get("timestamp_to")))
    return where