Given a dataset of contract metadata in a Pandas DataFrame, write a function to identify and impute missing values based on historical category averages. For grading, represent the DataFrame as a dictionary of column names to equal-length lists, with missing values represented by None. Return a new dictionary with missing entries in value_col replaced by the mean of observed values in the same category; leave them as None when no observed value exists. Implement def impute_missing_by_category(df, category_col, value_col): using only the Python standard library.
df contains category_col and value_col.value_col are numbers or None.df.def impute_missing_by_category(df, category_col, value_col):