'Returns a list of :class:`EC2SecurityGroup` objects for the
current region.
:param      group_ids: Returns only groups matching the provided
group IDs.
:type       group_ids: ``list``
:param      group_names: Returns only groups matching the provided
group names.
:type       group_ids: ``list``
:param      filters: The filters so that the list returned includes
information for specific security groups only.
:type       filters: ``dict``
:rtype:     ``list`` of :class:`EC2SecurityGroup`'

def ex_get_security_groups(self, group_ids=None, group_names=None, filters=None):

    params = {'Action': 'DescribeSecurityGroups'}
    if group_ids:
        params.update(self._pathlist('GroupId', group_ids))
    if group_names:
        for (name_idx, group_name) in enumerate(group_names):
            name_idx += 1
            name_key = ('GroupName.%s' % name_idx)
            params[name_key] = group_name
    if filters:
        params.update(self._build_filters(filters))
    response = self.connection.request(self.path, params=params)
    return self._to_security_groups(response.object)
