def _check_and_sanitize_datetime_instants(df):
<EOL>if df is None or len(df) == <NUM_LIT:0>:<EOL><INDENT>return df<EOL><DEDENT>if not isinstance(df.index, pd.DatetimeIndex):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if df.index.freq != "<STR_LIT:H>":<EOL><INDENT>forced_df = df.asfreq("<STR_LIT:H>")<EOL>try:<EOL><INDENT>assert_index_equal(df.index, forced_df.index)<EOL><DEDENT>except AssertionError:<EOL><INDENT>raise ValueError(<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>) from None<EOL><DEDENT>df = forced_df<EOL><DEDENT>if df.index[<NUM_LIT:0>].minute != <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return df<EOL>
Parameters
----------
df

Returns
-------
sanitized df