<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_api_gateway_resource(name):
 """Get the resource associated with our gateway."""

    client = boto3.client('apigateway', region_name=PRIMARY_REGION)
    matches = [x for x in client.get_rest_apis().get('items', list())
               if x['name'] == API_GATEWAY]
    match = matches.pop()
    resources = client.get_resources(restApiId=match.get('id'))
    resource_id = None
    for item in resources.get('items', list()):
        if item.get('pathPart', '/') != name:
            continue
        resource_id = item['id']
    return resource_id