code: def from_altair_chart(cls, altair_chart):
      if not cls._object_is_altair_chart(altair_chart):
          raise ValueError(
              _full_classname(altair_chart) + " is not an altair chart"
          )
      altair_chart_dict = altair_chart.to_dict()
      cht = cls(spec=altair_chart_dict)
      return cht
  
imports: from typing import Any, List, Optional, Union
  from .basic import LogComponent, ErrorComponent, ArtifactsComponent, TableComponent, ImageComponent, SectionComponent, MarkdownComponent
  from .card import MetaflowCardComponent
  from .convert_to_native_type import TaskToDict, _full_classname
  from .renderer_tools import render_safely
  import uuid
label_desc: Use image node_id 4 for calling the VegaChart obj's underlying member method code with example usage: obj.from_altair_chart(cls, altair_chart) and returns: cht