def prepare_region_data(df, scale_by=1):
    """Prepare regional data so that it can be used in train_model_region."""
    regions = df.region_name.unique()
    x_region = {}
    x_t_region = {}
    y_region = {}

    for i, region in enumerate(regions):
        x_region[region] = (
            df.loc[
                (df.region_name == region) & (df["cases_pos_hospitalized_icu"] > 0),
                "cases_pos_hospitalized_icu",
            ].to_numpy()[:-1]
            / scale_by
        )
        x_t_region[region] = (
            df.loc[
                (df.region_name == region) & (df["cases_pos_hospitalized_icu"] > 0),
                "cases_pos_hospitalized_icu_change",
            ].to_numpy()[1:]
            / scale_by
        )
        y_region[region] = (
            df.loc[
                (df.region_name == region) & (df["cases_pos_hospitalized_icu"] > 0),
                "cases_pos_hospitalized_icu_change",
            ].to_numpy()[1:]
            / scale_by
        )

    return x_region, x_t_region, y_region