':returns: item_list - list of Security Groups.
:returns: exception_map - A dict where the keys are a tuple containing the
location of the exception and the value is the actual exception'

def slurp(self):

    self.prep_for_slurp()
    item_list = []
    exception_map = {}
    from security_monkey.common.sts_connect import connect
    for account in self.accounts:
        account_db = Account.query.filter((Account.name == account)).first()
        account_number = account_db.identifier
        try:
            ec2 = connect(account, 'ec2')
            regions = ec2.get_all_regions()
        except Exception as e:
            exc = BotoConnectionIssue(str(e), self.index, account, None)
            self.slurp_exception((self.index, account), exc, exception_map, source='{}-watcher'.format(self.index))
            continue
        for region in regions:
            app.logger.debug('Checking    {}/{}/{}'.format(self.index, account, region.name))
            try:
                rec2 = connect(account, 'boto3.ec2.client', region=region)
                sgs = self.wrap_aws_rate_limited_call(rec2.describe_security_groups)
                if (self.get_detail_level() != 'NONE'):
                    tags = self.wrap_aws_rate_limited_call(rec2.describe_tags)
                    instances = self.wrap_aws_rate_limited_call(rec2.describe_instances)
                    app.logger.info('Number    of    instances    found    in    region    {}:    {}'.format(region.name, len(instances)))
            except Exception as e:
                if (region.name not in TROUBLE_REGIONS):
                    exc = BotoConnectionIssue(str(e), self.index, account, region.name)
                    self.slurp_exception((self.index, account, region.name), exc, exception_map, source='{}-watcher'.format(self.index))
                continue
            app.logger.debug('Found    {}    {}'.format(len(sgs), self.i_am_plural))
            if (self.get_detail_level() != 'NONE'):
                app.logger.info("Creating    mapping    of    sg_id's    to    instances")
                sg_instances = {}
                for reservation in instances['Reservations']:
                    for instance in reservation['Instances']:
                        for group in instance['SecurityGroups']:
                            if (group['GroupId'] not in sg_instances):
                                sg_instances[group['GroupId']] = [instance]
                            else:
                                sg_instances[group['GroupId']].append(instance)
                app.logger.info("Creating    mapping    of    instance_id's    to    tags")
                instance_tags = {}
                for tag in tags['Tags']:
                    if (tag['ResourceId'] not in instance_tags):
                        instance_tags[tag['ResourceId']] = [tag]
                    else:
                        instance_tags[tag['ResourceId']].append(tag)
                app.logger.info('Done    creating    mappings')
            for sg in sgs['SecurityGroups']:
                if self.check_ignore_list(sg['GroupName']):
                    continue
                arn = 'arn:aws:ec2:{region}:{account_number}:security-group/{security_group_id}'.format(region=region.name, account_number=account_number, security_group_id=sg['GroupId'])
                item_config = {'id': sg['GroupId'], 'name': sg['GroupName'], 'description': sg.get('Description'), 'vpc_id': sg.get('VpcId'), 'owner_id': sg.get('OwnerId'), 'region': region.name, 'rules': [], 'assigned_to': None, 'arn': arn}
                for rule in sg['IpPermissions']:
                    item_config['rules'] += self._build_rule(rule, 'ingress')
                for rule in sg['IpPermissionsEgress']:
                    item_config['rules'] += self._build_rule(rule, 'egress')
                item_config['rules'] = sorted(item_config['rules'])
                if (self.get_detail_level() == 'SUMMARY'):
                    if (sg['InstanceId'] in sg_instances):
                        item_config['assigned_to'] = '{}    instances'.format(len(sg_instances[sg['GroupId']]))
                    else:
                        item_config['assigned_to'] = '0    instances'
                elif (self.get_detail_level() == 'FULL'):
                    assigned_to = []
                    if (sg['GroupId'] in sg_instances):
                        for instance in sg_instances[sg['GroupId']]:
                            if (instance['InstanceId'] in instance_tags):
                                tagdict = {tag['Key']: tag['Value'] for tag in instance_tags[instance['InstanceId']]}
                                tagdict['instance_id'] = instance['InstanceId']
                            else:
                                tagdict = {'instance_id': instance['InstanceId']}
                            assigned_to.append(tagdict)
                    item_config['assigned_to'] = assigned_to
                if sg.get('VpcId'):
                    sg_name = '{0}    ({1}    in    {2})'.format(sg['GroupName'], sg['GroupId'], sg['VpcId'])
                else:
                    sg_name = '{0}    ({1})'.format(sg['GroupName'], sg['GroupId'])
                item = SecurityGroupItem(region=region.name, account=account, name=sg_name, arn=arn, config=item_config)
                item_list.append(item)
    return (item_list, exception_map)
