def _get_filter_field(field_name, field_value):
filter_field = None<EOL>if isinstance(field_value, ValueRange):<EOL><INDENT>range_values = {}<EOL>if field_value.lower:<EOL><INDENT>range_values.update({"<STR_LIT>": field_value.lower_string})<EOL><DEDENT>if field_value.upper:<EOL><INDENT>range_values.update({"<STR_LIT>": field_value.upper_string})<EOL><DEDENT>filter_field = {<EOL>"<STR_LIT>": {<EOL>field_name: range_values<EOL>}<EOL>}<EOL><DEDENT>elif _is_iterable(field_value):<EOL><INDENT>filter_field = {<EOL>"<STR_LIT>": {<EOL>field_name: field_value<EOL>}<EOL>}<EOL><DEDENT>else:<EOL><INDENT>filter_field = {<EOL>"<STR_LIT>": {<EOL>field_name: field_value<EOL>}<EOL>}<EOL><DEDENT>return filter_field<EOL>
Return field to apply into filter, if an array then use a range, otherwise look for a term match