<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flatten(self):
 """ Return a new expression where nested terms of this expression are flattened as far as possible. E.g. A & (B & C) becomes A & B & C. """

        args = list(self.args)
        i = 0
        for arg in self.args:
            if isinstance(arg, self.__class__):
                args[i:i + 1] = arg.args
                i += len(arg.args)
            else:
                i += 1

        return self.__class__(*args)