def __getitem__(self, key):
        # when key is a string containing the field name
        if isinstance(key, string_types):
            # Django templates access FormHelper attributes using dictionary [] operator
            # This could be a helper['form_id'] access, not looking for a field
            if hasattr(self, key):
                return getattr(self, key)

            self._check_layout()
            layout_field_names = self.layout.get_field_names()

            filtered_field = []
            for pointer in layout_field_names:
                # There can be an empty pointer
                if len(pointer) == 2 and pointer[1] == key:
                    filtered_field.append(pointer)

            return LayoutSlice(self.layout, filtered_field)

        return LayoutSlice(self.layout, key)
Return a LayoutSlice that makes changes affect the current instance of the layout
dataset/ETHPy150Open maraujop/django-crispy-forms/crispy_forms/helper.py/DynamicLayoutHandler.__getitem__