def pre_map(self, function):
if isinstance(self.slice, slice):<EOL><INDENT>for i in range(*self.slice.indices(len(self.layout.fields))):<EOL><INDENT>function(self.layout, i)<EOL><DEDENT><DEDENT>elif isinstance(self.slice, list):<EOL><INDENT>for pointer in self.slice:<EOL><INDENT>position = pointer[<NUM_LIT:0>]<EOL>if len(position) == <NUM_LIT:1>:<EOL><INDENT>function(self.layout, position[-<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>layout_object = self.layout.fields[position[<NUM_LIT:0>]]<EOL>for i in position[<NUM_LIT:1>:-<NUM_LIT:1>]:<EOL><INDENT>layout_object = layout_object.fields[i]<EOL><DEDENT>try:<EOL><INDENT>function(layout_object, position[-<NUM_LIT:1>])<EOL><DEDENT>except IndexError:<EOL><INDENT>raise DynamicError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Iterates over layout objects pointed in `self.slice` executing `function` on them.
It passes `function` penultimate layout object and the position where to find last one