code: def test_from_udf():
      def check_truth(df, all_true=False):
          if all_true:
              return pd.DataFrame({"bool": [True] * len(df)})
          return pd.DataFrame({"bool": df["a"] == df["b"]})
  
      predictor = Predictor.from_pandas_udf(check_truth)
  
      df = pd.DataFrame({"a": [1, 2, 3], "b": [1, 5, 6]})
  
      output = predictor.predict(df)
      output = output["bool"].tolist()
      assert output == [True, False, False]
  
      output = predictor.predict(df, all_true=True)
      output = output["bool"].tolist()
      assert output == [True, True, True]
  
imports: import uuid
  from typing import Dict, Optional, Union
  from unittest import mock
  import numpy
  import pandas
  import pytest
  import ray
  from ray.air.constants import TENSOR_COLUMN_NAME
  from ray.air.util.data_batch_conversion import BatchFormat
  from ray.data import Preprocessor
  from ray.train._internal.framework_checkpoint import FrameworkCheckpoint
  from ray.train.predictor import Predictor, PredictorNotSerializableException
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 6 for calling a global function with example usage: test_from_udf() and returns: pd, pd