Resolve security names to security groups resources.

def get_groups_by_names(self, names):
        """Resolve security names to security groups resources."""
        if not names:
            return []
        client = utils.local_session(
            self.manager.session_factory).client('ec2')
        sgs = self.manager.retry(
            client.describe_security_groups,
            Filters=[{
                'Name': 'group-name', 'Values': names}]).get(
                    'SecurityGroups', [])

        unresolved = set(names)
        for s in sgs:
            if s['GroupName'] in unresolved:
                unresolved.remove(s['GroupName'])

        if unresolved:
            raise PolicyExecutionError(self._format_error(
                "policy:{policy} security groups not found "
                "requested: {names}, found: {groups}",
                names=list(unresolved), groups=[g['GroupId'] for g in sgs]))
        return sgs