code: def test_custom_function_with_state(all_values):
      counter = [0]
  
      def pred_func(volume_guids, cntr):
          cntr[0] += 1
          return volume_guids in all_values
  
      test_predicate = in_lambda(["volume_guids"], pred_func, counter)
      for value in [
          "guid_2",
          "guid_1",
          "guid_5",
          "guid_XXX",
          "guid_XX",
      ]:
          included = test_predicate.do_include({"volume_guids": value})
          assert included == (value in all_values)
      assert counter[0] == 5
  
imports: import pytest
  import numpy
  from pyspark.sql import SparkSession
  from pyspark.sql.types import IntegerType
  from petastorm import make_reader
  from petastorm.codecs import ScalarCodec
  from petastorm.etl.dataset_metadata import materialize_dataset
  from petastorm.predicates import in_set, in_intersection, in_negate, in_reduce, in_pseudorandom_split, in_lambda
  from petastorm.tests.test_common import TestSchema
  from petastorm.unischema import dict_to_spark_row, Unischema, UnischemaField
label_desc: Use image node_id 5 for calling a global function with example usage: test_custom_function_with_state(all_values) and returns: unknown