<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ami_lookup(region='us-east-1', name='tomcat8'):
 """Look up AMI ID. Use _name_ to find AMI ID. If no ami_base_url or gitlab_token is provided, _name_ is returned as the 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_. """

    if AMI_JSON_URL:
        ami_dict = _get_ami_dict(AMI_JSON_URL)
        ami_id = ami_dict[region][name]
    elif GITLAB_TOKEN:
        warn_user('Use AMI_JSON_URL feature instead.')
        ami_contents = _get_ami_file(region=region)
        ami_dict = json.loads(ami_contents)
        ami_id = ami_dict[name]
    else:
        ami_id = name

    LOG.info('Using AMI: %s', ami_id)

    return ami_id