def __getitem__(self, index):
if isinstance(index, slice):<EOL><INDENT>return self.__class__(templates=self.templates.__getitem__(index))<EOL><DEDENT>elif isinstance(index, int):<EOL><INDENT>return self.templates.__getitem__(index)<EOL><DEDENT>else:<EOL><INDENT>_index = [i for i, t in enumerate(self.templates)<EOL>if t.name == index]<EOL>try:<EOL><INDENT>return self.templates.__getitem__(_index[<NUM_LIT:0>])<EOL><DEDENT>except IndexError:<EOL><INDENT>warnings.warn('<STR_LIT>' % index)<EOL>return []<EOL><DEDENT><DEDENT>
Support slicing to get Templates from Tribe.

.. rubric:: Example

>>> tribe = Tribe(templates=[Template(name='a'), Template(name='b'),
...                          Template(name='c')])
>>> tribe[1] # doctest: +NORMALIZE_WHITESPACE
Template b:
 0 channels;
 lowcut: None Hz;
 highcut: None Hz;
 sampling rate None Hz;
 filter order: None;
 process length: None s
>>> tribe[0:2]
Tribe of 2 templates