nodes: 0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
          Sort the families by template name.
  
  
          .. rubric:: Example
  
          >>> party = Party(families=[Family(template=Template(name='b')),
          ...                         Family(template=Template(name='a'))])
          >>> party[0]
          Family of 0 detections from template b
          >>> party.sort()[0]
          Family of 0 detections from template a
          """; 10, call; 11, identifier:self; 12, attribute; 13, argument_list; 14, attribute; 15, identifier:sort; 16, keyword_argument; 17, identifier:self; 18, identifier:families; 19, identifier:key; 20, lambda; 21, lambda_parameters; 22, attribute; 23, identifier:x; 24, attribute; 25, identifier:name; 26, identifier:x; 27, identifier:template
code: def sort(self):
          """
          Sort the families by template name.
  
  
          .. rubric:: Example
  
          >>> party = Party(families=[Family(template=Template(name='b')),
          ...                         Family(template=Template(name='a'))])
          >>> party[0]
          Family of 0 detections from template b
          >>> party.sort()[0]
          Family of 0 detections from template a
          """
          self.families.sort(key=lambda x: x.template.name)
          return self