code: def _export(
      model: Dashboard, export_related: bool = True
  ) -> Iterator[tuple[str, str]]:
      file_name = get_filename(model.dashboard_title, model.id)
      file_path = f"dashboards/{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
      for key, new_name in JSON_KEYS.items():
          value: Optional[str] = payload.pop(key, None)
          if value:
              try:
                  payload[new_name] = json.loads(value)
              except (TypeError, json.decoder.JSONDecodeError):
                  logger.info(
                      "Unable to decode `%s` field: %s", key, value
                  )
                  payload[new_name] = {}
  
      # Extract all native filter datasets and replace native
      # filter dataset references with uuid
      for native_filter in payload.get("metadata", {}).get(
          "native_filter_configuration", []
      ):
          for target in native_filter.get("targets", []):
              dataset_id = target.pop("datasetId", None)
              if dataset_id is not None:
                  dataset = DatasetDAO.find_by_id(dataset_id)
                  if dataset:
                      target["datasetUuid"] = str(dataset.uuid)
                      if export_related:
                          yield from ExportDatasetsCommand(
                              [dataset_id]
                          ).run()
  
      # the mapping between dashboard -> charts is inferred from the position
      # attribute, so if it's not present we need to add a default config
      if not payload.get("position"):
          payload["position"] = get_default_position(
              model.dashboard_title
          )
  
      # if any charts or not referenced in position, we need to add them
      # in a new row
      referenced_charts = find_chart_uuids(payload["position"])
      orphan_charts = {
          chart
          for chart in model.slices
          if str(chart.uuid) not in referenced_charts
      }
  
      if orphan_charts:
          payload["position"] = append_charts(
              payload["position"], orphan_charts
          )
  
      payload["version"] = EXPORT_VERSION
  
      file_content = yaml.safe_dump(payload, sort_keys=False)
      yield file_path, file_content
  
      if export_related:
          chart_ids = [chart.id for chart in model.slices]
          yield from ExportChartsCommand(chart_ids).run()
  
imports: import json
  import logging
  import random
  import string
  from typing import Any, Optional
  from collections.abc import Iterator
  import yaml
  from superset.commands.chart.export import ExportChartsCommand
  from superset.commands.dashboard.exceptions import DashboardNotFoundError
  from superset.commands.dashboard.importers.v1.utils import find_chart_uuids
  from superset.daos.dashboard import DashboardDAO
  from superset.commands.export.models import ExportModelsCommand
  from superset.commands.dataset.export import ExportDatasetsCommand
  from superset.daos.dataset import DatasetDAO
  from superset.models.dashboard import Dashboard
  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 ExportDashboardsCommand obj's underlying member method code with example usage: obj._export(model, export_related) without return types