def __getitem__(self, item):
        """
        Gets a layer according to its index or its name

        :param item: layer index or name
        :return: BaseLayer object.
        """
        if isinstance(item, int):
            return self.layers[item]
        for layer in self.layers:
            if layer.layer_name.lower() == item.lower():
                return layer
        raise KeyError('Layer does not exist in packet')

        Gets a layer according to its index or its name

        :param item: layer index or name
        :return: BaseLayer object.
        
src/pyshark/packet/packet.py