code: def test_for_each(self):
      file_path = os.path.join(self.resource_path, "orca/data/csv")
      shards = bigdl.orca.data.pandas.read_csv(file_path)
  
      def get_item(data, key):
          return data[key]
  
      result1 = shards._for_each(get_item, "location")
      import pandas as pd
  
      assert isinstance(result1.first(), pd.Series)
      result2 = shards._for_each(get_item, "abc")
      assert isinstance(result2.first(), KeyError)
  
imports: import os.path
  import pytest
  from unittest import TestCase
  import bigdl.orca.data
  import bigdl.orca.data.pandas
  from bigdl.orca.data import SharedValue
  from bigdl.dllib.nncontext import *
  from bigdl.orca.data.transformer import *
  from bigdl.orca import init_orca_context
label_desc: Use image node_id 10 for calling the TestSparkXShards obj's underlying member method code with example usage: obj.test_for_each() and returns: data