code: def _validate_group(self, group):
          
          # All groups allowed
          if self._show_all_groups:
              return
  
          # Group specifically allowed
          if group.id in self._allowed_group_ids:
              return
  
          # Group allowed by subgroup membership
          for parent_group_id in self._allowed_subgroup_ids:
              # Get each group, and check subgroup ids
              parent_group = self._swimlane.groups.get(id=parent_group_id)
              parent_group_child_ids = set([g['id'] for g in parent_group._raw['groups']])
              if group.id in parent_group_child_ids:
                  return
  
          raise ValidationError(
              self.record,
              'Group `{}` is not a valid selection for field `{}`'.format(
                  group,
                  self.name
              )
          )
docs: Validate a Group instance against allowed group IDs or subgroup of a parent group