<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_template_name(env, pipeline_type):
 """Generates the correct template name based on pipeline type Args: env (str):
 environment to generate templates for pipeline_type (str):
 Type of pipeline like ec2 or lambda Returns: str: Name of template """

    pipeline_base = 'pipeline/pipeline'
    template_name_format = '{pipeline_base}'
    if env.startswith('prod'):
        template_name_format = template_name_format + '_{env}'
    else:
        template_name_format = template_name_format + '_stages'

    if pipeline_type != 'ec2':
        template_name_format = template_name_format + '_{pipeline_type}'

    template_name_format = template_name_format + '.json.j2'
    template_name = template_name_format.format(pipeline_base=pipeline_base, env=env, pipeline_type=pipeline_type)

    return template_name