def to_dict(self):
raw_conditions = []<EOL>for condition in self.conditions:<EOL><INDENT>if isinstance(condition, (Condition, Group)):<EOL><INDENT>raw_conditions.append(condition.to_dict())<EOL><DEDENT>else:<EOL><INDENT>raw_conditions.append(condition)<EOL><DEDENT><DEDENT>return {self.operator: raw_conditions}<EOL>
Return a dictionary suitable for use with pymongo as a filter