code: def test_actor_repr_in_traceback(ray_start_regular):
      def parse_labels_from_traceback(ex):
          error_msg = str(ex)
          error_lines = error_msg.split("\n")
          traceback_line = error_lines[0]
          unformatted_labels = traceback_line.split("(")[2].split(", ")
          label_dict = {}
          for label in unformatted_labels:
              # Remove parenthesis if included.
              if label.startswith("("):
                  label = label[1:]
              elif label.endswith(")"):
                  label = label[:-1]
              key, value = label.split("=", 1)
              label_dict[key] = value
          return label_dict
  
      # Test the default repr is Actor(repr=[class_name])
      def g(a):
          raise ValueError(a)
  
      @ray.remote
      class A:
          def f(self):
              a = 3
              b = 4
              c = a + b
              return g(c)
  
          def get_repr(self):
              return repr(self)
  
      a = A.remote()
      try:
          ray.get(a.f.remote())
      except ValueError as ex:
          print(ex)
          label_dict = parse_labels_from_traceback(ex)
          assert label_dict["repr"] == ray.get(a.get_repr.remote())
  
      # Test if the repr is properly overwritten.
      actor_repr = "ABC"
  
      @ray.remote
      class A:
          def f(self):
              a = 3
              b = 4
              c = a + b
              return g(c)
  
          def __repr__(self):
              return actor_repr
  
      a = A.remote()
      try:
          ray.get(a.f.remote())
      except ValueError as ex:
          print(ex)
          label_dict = parse_labels_from_traceback(ex)
          assert label_dict["repr"] == actor_repr
  
file_path: ray/python/ray/tests/test_traceback.py
imports: import re
  import sys
  import threading
  import pytest
  import ray
  from ray.exceptions import RayTaskError, RayActorError
label_desc: Use image node_id 8 for calling a global function with example usage: test_actor_repr_in_traceback(ray_start_regular) and returns: label_dict, g, repr, g, actor_repr