def strip_empty_values(obj):
if isinstance(obj, dict):<EOL><INDENT>new_obj = {}<EOL>for key, val in obj.items():<EOL><INDENT>new_val = strip_empty_values(val)<EOL>if new_val is not None:<EOL><INDENT>new_obj[key] = new_val<EOL><DEDENT><DEDENT>return new_obj or None<EOL><DEDENT>elif isinstance(obj, (list, tuple, set)):<EOL><INDENT>new_obj = []<EOL>for val in obj:<EOL><INDENT>new_val = strip_empty_values(val)<EOL>if new_val is not None:<EOL><INDENT>new_obj.append(new_val)<EOL><DEDENT><DEDENT>return type(obj)(new_obj) or None<EOL><DEDENT>elif obj or obj is False or obj == <NUM_LIT:0>:<EOL><INDENT>return obj<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
Recursively strips empty values.