def _validate_group(self, group):
<EOL>if self._show_all_groups:<EOL><INDENT>return<EOL><DEDENT>if group.id in self._allowed_group_ids:<EOL><INDENT>return<EOL><DEDENT>for parent_group_id in self._allowed_subgroup_ids:<EOL><INDENT>parent_group = self._swimlane.groups.get(id=parent_group_id)<EOL>parent_group_child_ids = set([g['<STR_LIT:id>'] for g in parent_group._raw['<STR_LIT>']])<EOL>if group.id in parent_group_child_ids:<EOL><INDENT>return<EOL><DEDENT><DEDENT>raise ValidationError(<EOL>self.record,<EOL>'<STR_LIT>'.format(<EOL>group,<EOL>self.name<EOL>)<EOL>)<EOL>
Validate a Group instance against allowed group IDs or subgroup of a parent group