code: def get_groups(self, resources):
          
          resolved_groups = self.get_groups_by_names(self.get_action_group_names())
          return_groups = []
  
          for idx, r in enumerate(resources):
              rgroups = self.sg_expr.search(r) or []
              add_groups = self.resolve_group_names(
                  r, self._get_array('add'), resolved_groups)
              remove_groups = self.resolve_remove_symbols(
                  r,
                  self.resolve_group_names(
                      r, self._get_array('remove'), resolved_groups),
                  rgroups)
              isolation_groups = self.resolve_group_names(
                  r, self._get_array('isolation-group'), resolved_groups)
  
              for g in remove_groups:
                  if g in rgroups:
                      rgroups.remove(g)
              for g in add_groups:
                  if g not in rgroups:
                      rgroups.append(g)
  
              if not rgroups:
                  rgroups = list(isolation_groups)
  
              return_groups.append(rgroups)
  
          return return_groups
docs: Return lists of security groups to set on each resource
  
          For each input resource, parse the various add/remove/isolation-
          group policies for 'modify-security-groups' to find the resulting
          set of VPC security groups to attach to that resource.
  
          Returns a list of lists containing the resulting VPC security groups
          that should end up on each resource passed in.
  
          :param resources: List of resources containing VPC Security Groups
          :return: List of lists of security groups per resource