code: def _groupby_dot(df, weights):
      """Groupby dot product.
  
      Groups df by axis 1, level 1, and applies dot product with weights.
  
      Parameters
      ----------
      df : pd.DataFrame
          dataframe to groupby
      weights : np.array
          weights to apply to each group
  
      Returns
      -------
      out : pd.DataFrame
          dataframe with weighted groupby dot product
      """
      out = df.groupby(axis=1, level=1).apply(lambda x: x.dot(weights))
      return out
  
imports: from logging import warning
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype
  from sklearn.utils import check_array, check_consistent_length
  from sktime.datatypes import check_is_scitype, convert, convert_to
  from sktime.performance_metrics.forecasting._classes import BaseForecastingErrorMetric
  from sktime.performance_metrics.forecasting._coerce import _coerce_to_scalar
label_desc: Use image node_id 1 for calling a global function with example usage: _groupby_dot(df, weights) and returns: out