def 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.fields[i])<EOL><DEDENT><DEDENT>elif isinstance(self.slice, list):<EOL><INDENT>for pointer in self.slice:<EOL><INDENT>position = pointer[<NUM_LIT:0>]<EOL>layout_object = self.layout.fields[position[<NUM_LIT:0>]]<EOL>for i in position[<NUM_LIT:1>:]:<EOL><INDENT>previous_layout_object = layout_object<EOL>layout_object = layout_object.fields[i]<EOL><DEDENT>if (<EOL>function.__name__ == '<STR_LIT>'<EOL>and isinstance(layout_object, string_types)<EOL>):<EOL><INDENT>function(previous_layout_object)<EOL><DEDENT>else:<EOL><INDENT>function(layout_object)<EOL><DEDENT><DEDENT><DEDENT>
Iterates over layout objects pointed in `self.slice` executing `function` on them
It passes `function` last layout object