def __getitem__(self, index):
if len(self.families) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>if isinstance(index, slice):<EOL><INDENT>return self.__class__(families=self.families.__getitem__(index))<EOL><DEDENT>elif isinstance(index, int):<EOL><INDENT>return self.families.__getitem__(index)<EOL><DEDENT>else:<EOL><INDENT>_index = [i for i, family in enumerate(self.families)<EOL>if family.template.name == index]<EOL>try:<EOL><INDENT>return self.families.__getitem__(_index[<NUM_LIT:0>])<EOL><DEDENT>except IndexError:<EOL><INDENT>warnings.warn('<STR_LIT>' % index)<EOL>return []<EOL><DEDENT><DEDENT>
Get families from the Party. Can accept either an index or slice.

:param index: Family number or name, or slice.
:return: Party (if a slice is given) or a single Family

.. rubric:: Example

Extract a single family:

>>> party = Party(families=[Family(template=Template(name='a')),
...                         Family(template=Template(name='b')),
...                         Family(template=Template(name='c'))])
>>> party[1]
Family of 0 detections from template b


Extract a list of families by giving a slice:

>>> party = Party(families=[Family(template=Template(name='a')),
...                         Family(template=Template(name='b')),
...                         Family(template=Template(name='c'))])
>>> party[1:]
Party of 2 Families.

Extract a single family by template name:

>>> party = Party(families=[Family(template=Template(name='a')),
...                         Family(template=Template(name='b')),
...                         Family(template=Template(name='c'))])
>>> party['b']
Family of 0 detections from template b