<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_climis_crop_production_data(data_dir: str):
 """ Process CliMIS crop production data """


    climis_crop_production_csvs = glob(
        "{data_dir}/Climis South Sudan Crop Production Data/"
        "Crops_EstimatedProductionConsumptionBalance*.csv"
    )
    state_county_df = pd.read_csv(
        f"{data_dir}/ipc_data.csv", skipinitialspace=True
    )
    combined_records = []

    for f in climis_crop_production_csvs:
        year = int(f.split("/")[-1].split("_")[2].split(".")[0])
        df = pd.read_csv(f).dropna()
        for i, r in df.iterrows():
            record = {
                "Year": year,
                "Month": None,
                "Source": "CliMIS",
                "Country": "South Sudan",
            }
            region = r["State/County"].strip()

            if region.lower() in state_county_df["State"].str.lower().values:
                record["State"] = region
                record["County"] = None
            else:
                potential_states = state_county_df.loc[
                    state_county_df["County"] == region
                ]["State"]
                record["State"] = (
                    potential_states.iloc[0]
                    if len(potential_states) != 0
                    else None
                )
                record["County"] = region

            for field in r.index:
                if field != "State/County":
                    if "Net Cereal production" in field:
                        record["Variable"] = "Net Cereal Production"
                        record["Value"] = r[field]
                    if field.split()[-1].startswith("("):
                        record["Unit"] = field.split()[-1][1:-1].lower()
                    else:
                        record["Unit"] = None

            combined_records.append(record)

    df = pd.DataFrame(combined_records)
    return df