def expand(self, generator, node, depth):
        content = getattr(node, self.field)
        if self.action in ['join', 'join_lws', 'each_lpad', 'each_rpad'] and self.args and self.args[0] != '\n':
            depth = 0

        if isinstance(content, Iterable):
            if content:
                expanded = [generator._generate_node(content[0], depth)]
                # print(content[0].y)
                # print(self.field)
                # print(node.y)
                # input(self.action)
                expanded += [generator.offset(depth) + generator._generate_node(a, depth) for a in content[1:]]
            else:
                expanded = []
        else:
            expanded = generator._generate_node(content, node)
        return getattr(generator, 'action_%s' % self.action)(expanded, *(self.args + [depth]))
dataset/ETHPy150Open alehander42/pseudo/pseudo/code_generator_dsl.py/Action.expand/original