code: def to_action_object(obj: Any) -> ActionObject:
      if isinstance(obj, ActionObject):
          return obj
  
      if type(obj) in action_types:
          return action_types[type(obj)](syft_action_data_cache=obj)
      raise Exception(f"{type(obj)} not in action_types")
  
imports: from __future__ import annotations
  from typing import Any
  from typing import Dict
  from typing import Optional
  import pydantic
  from ..serde.serializable import serializable
  from ..service.action.action_object import ActionObject
  from ..service.action.action_object import TwinMode
  from ..service.action.action_types import action_types
  from .syft_object import SyftObject
  from .uid import UID
label_desc: Use image node_id 1 for calling a global function with example usage: to_action_object(obj) and returns: obj, action_types