def METHOD_NAME(submission, prompts):
    """
    1. Convert from legacy format.
    2. Add prompts to submission['answer']['parts'] to simplify iteration in the template.
    Args:
        submission (dict): Submission dictionary.
        prompts (list of dict): The prompts from the problem definition.
    Returns:
        dict
    """
    parts = [{'prompt': prompt, 'text': ''} for prompt in prompts]
    if 'text' in submission['answer']:
        parts[0]['text'] = submission['answer'].pop('text')
    else:
        for index, part in enumerate(submission['answer'].pop('parts')):
            parts[index]['text'] = part['text']
    submission['answer']['parts'] = parts
    return submission