def duplicate_configuration(template_configuration, new_context, new_platform):
    """Copy a template configuration, set the new context, and return it."""
    new_configuration = template_configuration.copy()
    new_configuration.set_context(new_context)
    new_configuration.set_platform(new_platform)
    return new_configuration