code: def _export(
      model: Slice, export_related: bool = True
  ) -> Iterator[tuple[str, str]]:
      file_name = get_filename(model.slice_name, model.id)
      file_path = f"charts/{file_name}.yaml"
  
      payload = model.export_to_dict(
          recursive=False,
          include_parent_ref=False,
          include_defaults=True,
          export_uuids=True,
      )
      # TODO (betodealmeida): move this logic to export_to_dict once this
      #  becomes the default export endpoint
      payload = {
          key: value
          for key, value in payload.items()
          if key not in REMOVE_KEYS
      }
  
      if payload.get("params"):
          try:
              payload["params"] = json.loads(payload["params"])
          except json.decoder.JSONDecodeError:
              logger.info(
                  "Unable to decode `params` field: %s",
                  payload["params"],
              )
  
      payload["version"] = EXPORT_VERSION
      if model.table:
          payload["dataset_uuid"] = str(model.table.uuid)
  
      file_content = yaml.safe_dump(payload, sort_keys=False)
      yield file_path, file_content
  
      if model.table and export_related:
          yield from ExportDatasetsCommand([model.table.id]).run()
  
file_path: superset/superset/commands/chart/export.py
imports: import json
  import logging
  from collections.abc import Iterator
  import yaml
  from superset.commands.chart.exceptions import ChartNotFoundError
  from superset.daos.chart import ChartDAO
  from superset.commands.dataset.export import ExportDatasetsCommand
  from superset.commands.export.models import ExportModelsCommand
  from superset.models.slice import Slice
  from superset.utils.dict_import_export import EXPORT_VERSION
  from superset.utils.file import get_filename
label_desc: Use image node_id 1 for calling the ExportChartsCommand obj's underlying member method code with example usage: obj._export(model, export_related) without return types