def METHOD_NAME(
    df: pd.DataFrame, index_names: List[str], log: stdlib.BoundLogger
) -> pd.DataFrame:
    """Return a `DataFrame` with index set to `index_names` if not already set, and rows and columns sorted."""
    if df.index.names != index_names:
        log.warning("Fixing DataFrame index", current_index=df.index.names)
        if df.index.names != [None]:
            df = df.reset_index(inplace=False)
        df = df.set_index(index_names, inplace=False)
    df = df.sort_index()
    if "index" in df.columns:
        # This is not expected in our normal code path but seems to sneak in occasionally
        # when calling reset_index on a DataFrame that doesn't have a named index.
        log.warning("Dropping column named 'index'")
        df = df.drop(columns="index")
    df = sort_common_field_columns(df)
    return df