code: def _predict(
      self, df: pd.DataFrame
  ) -> Union[pd.Series, pd.DataFrame]:
      if self._fitted == 0:
          raise RuntimeError("The model must be trained first.")
      if isinstance(df, pd.DataFrame):
          if df.columns.duplicated().any():
              raise ValueError(
                  "Input DataFrame must have unique column names."
              )
          if not (set(df.columns) >= set(self._cols)):
              raise ValueError(
                  "The model was trained by a pandas DataFrame with columns "
                  "{}, but the input DataFrame does not contain columns {}.".format(
                      self._cols,
                      list(set(self._cols) - set(df.columns)),
                  )
              )
          df_copy = (
              df.loc[:, self._cols].copy() if self._cols else df.copy()
          )  # in a customized hd model that doesn't need fit, self._cols is empty
          predicted = self._predict_core(df_copy)
      else:
          raise TypeError("Input must be a pandas DataFrame.")
      # make sure index freq is the same (because pandas has a bug that some
      # operation, e.g. concat, may change freq)
      predicted.index.freq = df.index.freq
      return predicted
  
imports: from abc import ABC, abstractmethod
  from copy import deepcopy
  from typing import Any, Dict, List, Tuple, Union
  import pandas
label_desc: Use image node_id 3 for calling the _TrainableMultivariateModel obj's underlying member method code with example usage: obj._predict(df) and returns: predicted