# Buggy code
def load_resource(self, item):
    resource = super(ConfigS3, self).load_resource(item)
    cfg = item["supplementaryConfiguration"]
    # aka standard
    if "awsRegion" in item and item["awsRegion"] != "us-east-1":
        resource["Location"] = {"LocationConstraint": item["awsRegion"]}

    # owner is under acl per describe
    resource.pop("Owner", None)
    resource["CreationDate"] = parse_date(resource["CreationDate"])

    for k, null_value in S3_CONFIG_SUPPLEMENT_NULL_MAP.items():
        if cfg.get(k) == null_value:
            continue
        method = getattr(self, "handle_%s" % k, None)
        if method is None:
            raise ValueError("unhandled supplementary config %s", k)
            continue
        v = cfg[k]
        if isinstance(cfg[k], six.string_types):
            v = json.loads(cfg[k])
        method(resource, v)

    for el in S3_AUGMENT_TABLE:
        if el[1] not in resource:
            resource[el[1]] = el[2]
    return resource


# Traceback (AttributeError)
[ERROR] AttributeError: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "/var/task/custodian_policy.py", line 4, in run
return handler.dispatch_event(event, context)
File "/var/task/c7n/handler.py", line 168, in dispatch_event
p.push(event, context)
File "/var/task/c7n/policy.py", line 932, in push
return mode.run(event, lambda_ctx)
File "/var/task/c7n/policy.py", line 729, in run
resources = super(ConfigRuleMode, self).run(event, lambda_context)
File "/var/task/c7n/policy.py", line 484, in run
results = action.process(resources)
File "/var/task/c7n/tags.py", line 474, in process
self.process_resource_set, self.id_key, resources, tags, self.log)
File "/var/task/c7n/tags.py", line 136, in _common_tag_processer
raise error
File "/var/lang/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/var/task/c7n/resources/s3.py", line 2274, in process_resource_set
self.manager.session_factory, resource_set, remove_tags=tags)
File "/var/task/c7n/resources/s3.py", line 505, in modify_bucket_tags
client = bucket_client(local_session(session_factory), bucket)
File "/var/task/c7n/resources/s3.py", line 490, in bucket_client
region = get_region(b)
File "/var/task/c7n/resources/s3.py", line 558, in get_region
region = b.get('Location',
{}
).get('LocationConstraint')

# Fixed code
def load_resource(self, item):
    resource = super(ConfigS3, self).load_resource(item)
    cfg = item["supplementaryConfiguration"]
    # aka standard
    if "awsRegion" in item and item["awsRegion"] != "us-east-1":
        resource["Location"] = {"LocationConstraint": item["awsRegion"]}
    else:
        resource["Location"] = {}

    # owner is under acl per describe
    resource.pop("Owner", None)
    resource["CreationDate"] = parse_date(resource["CreationDate"])

    for k, null_value in S3_CONFIG_SUPPLEMENT_NULL_MAP.items():
        if cfg.get(k) == null_value:
            continue
        method = getattr(self, "handle_%s" % k, None)
        if method is None:
            raise ValueError("unhandled supplementary config %s", k)
            continue
        v = cfg[k]
        if isinstance(cfg[k], six.string_types):
            v = json.loads(cfg[k])
        method(resource, v)

    for el in S3_AUGMENT_TABLE:
        if el[1] not in resource:
            resource[el[1]] = el[2]
    return resource