<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_api_gateway():
 """Create the Blockade API Gateway REST service."""

    logger.debug("[#] Setting up the API 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]
    if len(matches) > 0:
        logger.debug("[#] API Gateway already setup")
        return matches.pop()

    response = client.create_rest_api(
        name=API_GATEWAY,
        description='REST-API to power the Blockade service'
    )
    logger.info("[#] Successfully setup the API Gateway")

    return response