code: def import_dashboards(
      session: Session,
      content: str,
      database_id: Optional[int] = None,
      import_time: Optional[int] = None,
  ) -> None:
      """Imports dashboards from a stream to databases"""
      current_tt = int(time.time())
      import_time = current_tt if import_time is None else import_time
      data = json.loads(content, object_hook=decode_dashboards)
      if not data:
          raise DashboardImportException(_("No data in file"))
      dataset_id_mapping: dict[int, int] = {}
      for table in data["datasources"]:
          new_dataset_id = import_dataset(
              table, database_id, import_time=import_time
          )
          params = json.loads(table.params)
          dataset_id_mapping[params["remote_id"]] = new_dataset_id
  
      session.commit()
      for dashboard in data["dashboards"]:
          import_dashboard(
              dashboard, dataset_id_mapping, import_time=import_time
          )
      session.commit()
  
imports: import json
  import logging
  import time
  from copy import copy
  from datetime import datetime
  from typing import Any, Optional
  from flask_babel import lazy_gettext
  from sqlalchemy.orm import make_transient, Session
  from superset import db
  from superset.commands.base import BaseCommand
  from superset.commands.dataset.importers.v0 import import_dataset
  from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
  from superset.exceptions import DashboardImportException
  from superset.models.dashboard import Dashboard
  from superset.models.slice import Slice
  from superset.utils.dashboard_filter_scopes_converter import convert_filter_scopes, copy_filter_scopes
label_desc: Use image node_id 4 for calling a global function with example usage: import_dashboards(session, content, database_id, import_time) without return types