def list(self, stack_id, resource_name=None, **kwargs):
        """Get a list of events.

        :param stack_id: ID of stack the events belong to
        :param resource_name: Optional name of resources to filter events by
        :rtype: list of :class:`Event`
        """
        params = {}
        if 'filters' in kwargs:
            filters = kwargs.pop('filters')
            params.update(filters)

        for key, value in six.iteritems(kwargs):
            if value:
                params[key] = value

        if resource_name is None:
            url = '/stacks/%s/events' % stack_id
        else:
            stack_id = self._resolve_stack_id(stack_id)
            url = '/stacks/%s/resources/%s/events' % (
                parse.quote(stack_id, ''),
                parse.quote(encodeutils.safe_encode(resource_name), ''))
        if params:
            url += '?%s' % parse.urlencode(params, True)

        return self._list(url, 'events')