<commit_before>"""Lookup AMI ID from a simple name."""
import json
import logging
import os
from base64 import b64decode

import gitlab

from ..consts import GIT_URL, GITLAB_TOKEN

LOG = logging.getLogger(__name__)


def ami_lookup(region='us-east-1', name='tomcat8'):
    """Use _name_ to find AMI ID.

    Args:
        region (str): AWS Region to find AMI ID.
        name (str): Simple AMI base name to lookup.

    Returns:
        str: AMI ID for _name_ in _region_.
    """

    server = gitlab.Gitlab(GIT_URL, token=GITLAB_TOKEN)
    project_id = server.getproject('devops/ansible')['id']

    ami_blob = server.getfile(project_id, 'scripts/{0}.json'.format(region),
                              'master')
    ami_contents = b64decode(ami_blob['content']).decode()
    LOG.debug('AMI table: %s', ami_contents)

    ami_dict = json.loads(ami_contents)

    return ami_dict[name]

print(ami_lookup())<commit_msg>fix: Remove print<commit_after>"""Lookup AMI ID from a simple name."""
import json
import logging
import os
from base64 import b64decode

import gitlab

from ..consts import GIT_URL, GITLAB_TOKEN

LOG = logging.getLogger(__name__)


def ami_lookup(region='us-east-1', name='tomcat8'):
    """Use _name_ to find AMI ID.

    Args:
        region (str): AWS Region to find AMI ID.
        name (str): Simple AMI base name to lookup.

    Returns:
        str: AMI ID for _name_ in _region_.
    """

    server = gitlab.Gitlab(GIT_URL, token=GITLAB_TOKEN)
    project_id = server.getproject('devops/ansible')['id']

    ami_blob = server.getfile(project_id, 'scripts/{0}.json'.format(region),
                              'master')
    ami_contents = b64decode(ami_blob['content']).decode()
    LOG.debug('AMI table: %s', ami_contents)

    ami_dict = json.loads(ami_contents)

    return ami_dict[name]
{'fraction_non_alphanumeric': 0.11916529379461833, 'fraction_numerical': 0.009884678747940691, 'mean_word_length': 3.207852193995381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '647249', 'n_tokens_mistral': 626, 'n_tokens_neox': 603, 'n_words': 160}