def METHOD_NAME(df: pd.DataFrame, prune: bool = True) -> pd.DataFrame:
    """Convert backported table from long to wide format.
    :params prune: Drop columnd entity_id, entity_code and rename entity_name to country.
    """
    # convert to wide format
    long_mem_usage_mb = df.memory_usage().sum() / 1e6
    if prune:
        df = df.rename(columns={"entity_name": "country"}).pivot(
            index=["year", "country"],
            columns="variable_name",
            values="value",
        )
    else:
        df = df.pivot(
            index=["year", "entity_name", "entity_id", "entity_code"],
            columns="variable_name",
            values="value",
        )
    # remove `variable_name` label
    df.columns.name = None
    # report compression ratio if the file is larger than >1MB
    # NOTE: memory usage can further drop later after repack_frame is called
    wide_mem_usage_mb = df.memory_usage().sum() / 1e6 if not df.empty else 0
    if wide_mem_usage_mb > 1:
        log.info(
            "create_wide_table",
            wide_mb=wide_mem_usage_mb,
            long_mb=long_mem_usage_mb,
            density=f"{df.notnull().sum().sum() / (df.shape[0] * df.shape[1]):.1%}",
            compression=f"{wide_mem_usage_mb / long_mem_usage_mb:.1%}",
        )
    return df