def build_target_key_from_recipe()

in auto_sizing/export_json.py [0:0]


def build_target_key_from_recipe(recipe_info: SizingRecipe) -> str:
    # parse out recipe fields
    app_id = recipe_info.get("app_id")
    channel = recipe_info.get("channel")
    locale = recipe_info.get("locale")
    country = recipe_info.get("country")

    # target_key should be an easy lookup for relevant sizing
    # {app_id}:{channel}:{locale}:{country}

    target_key = f"{app_id}"
    if channel:
        target_key += f":{channel}"
    if locale:
        eval_locale = eval(locale)
        sorted_locale = sorted(eval_locale) if type(eval_locale) is tuple else [eval_locale]
        # string representation of list includes spaces between elements
        target_key += f":{sorted_locale}".replace(" ", "")
    if country:
        target_key += f":{country}"

    return target_key