def METHOD_NAME(self, tree):
    field = self.walk(tree.field)
    operators = {"<": operator.lt, "<=": operator.le, ">=": operator.ge, ">": operator.gt}
    check_range = self.walk(tree.value, operators[tree.operator])
    return lambda doc: check_range(field(doc))