code: def _infer_df_func_returns(self, df, dtypes):
      if self.output_types[0] == OutputType.dataframe:
          test_df = build_df(df, fill_value=1, size=2)
          try:
              with np.errstate(all="ignore"), quiet_stdio():
                  if self.call_agg:
                      infer_df = test_df.agg(
                          self._func,
                          axis=self._axis,
                          *self.args,
                          **self.kwds,
                      )
                  else:
                      infer_df = test_df.transform(
                          self._func,
                          axis=self._axis,
                          *self.args,
                          **self.kwds,
                      )
          except:  # noqa: E722
              infer_df = None
      else:
          test_df = build_series(df, size=2, name=df.name)
          try:
              with np.errstate(all="ignore"), quiet_stdio():
                  if self.call_agg:
                      infer_df = test_df.agg(
                          self._func, args=self.args, **self.kwds
                      )
                  else:
                      if not _with_convert_dtype:
                          infer_df = test_df.transform(
                              self._func, *self.args, **self.kwds
                          )
                      else:  # pragma: no cover
                          infer_df = test_df.transform(
                              self._func,
                              convert_dtype=self.convert_dtype,
                              args=self.args,
                              **self.kwds,
                          )
          except:  # noqa: E722
              infer_df = None
  
      if infer_df is None and dtypes is None:
          raise TypeError(
              "Failed to infer dtype, please specify dtypes as arguments."
          )
  
      if infer_df is None:
          is_df = self.output_types[0] == OutputType.dataframe
      else:
          is_df = isinstance(infer_df, pd.DataFrame)
  
      if is_df:
          new_dtypes = (
              make_dtypes(dtypes)
              if dtypes is not None
              else infer_df.dtypes
          )
          self.output_types = [OutputType.dataframe]
      else:
          new_dtypes = (
              dtypes
              if dtypes is not None
              else (infer_df.name, infer_df.dtype)
          )
          self.output_types = [OutputType.series]
  
      return new_dtypes
  
imports: import numpy
  import pandas
  from ...None import opcodes
  from ...config import options
  from ...core import OutputType, recursive_tile
  from ...core.custom_log import redirect_custom_log
  from ...serialization.serializables import AnyField, BoolField, TupleField, DictField
  from ...utils import enter_current_session, quiet_stdio, pd_release_version
  from ..core import DATAFRAME_CHUNK_TYPE, DATAFRAME_TYPE
  from ..operands import DataFrameOperandMixin, DataFrameOperand
  from ..utils import build_df, build_series, validate_axis, parse_index, filter_dtypes_by_index, make_dtypes
label_desc: Use image node_id 10 for calling the TransformOperand obj's underlying member method code with example usage: obj._infer_df_func_returns(df, dtypes) and returns: new_dtypes