def __getitem__(self, key):
<EOL>if isinstance(key, string_types):<EOL><INDENT>if hasattr(self, key):<EOL><INDENT>return getattr(self, key)<EOL><DEDENT>self._check_layout()<EOL>layout_field_names = self.layout.get_field_names()<EOL>filtered_field = []<EOL>for pointer in layout_field_names:<EOL><INDENT>if len(pointer) == <NUM_LIT:2> and pointer[<NUM_LIT:1>] == key:<EOL><INDENT>filtered_field.append(pointer)<EOL><DEDENT><DEDENT>return LayoutSlice(self.layout, filtered_field)<EOL><DEDENT>return LayoutSlice(self.layout, key)<EOL>
Return a LayoutSlice that makes changes affect the current instance of the layout
and not a copy.