code: def flatten(self):
          
          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)
docs: 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.