code: def create_dashboard(
      slug: str, title: str, position: str, slices: list[Slice]
  ) -> Dashboard:
      dash = (
          db.session.query(Dashboard).filter_by(slug=slug).one_or_none()
      )
      if dash:
          return dash
      dash = Dashboard()
      dash.dashboard_title = title
      if position is not None:
          js = position
          pos = json.loads(js)
          dash.position_json = json.dumps(pos, indent=4)
      dash.slug = slug
      if slices is not None:
          dash.slices = slices
      db.session.add(dash)
      db.session.commit()
  
      return dash
  
file_path: superset/tests/integration_tests/dashboard_utils.py
imports: import json
  from typing import Optional
  from pandas import DataFrame
  from superset import db
  from superset.connectors.sqla.models import SqlaTable
  from superset.models.core import Database
  from superset.models.dashboard import Dashboard
  from superset.models.slice import Slice
  from superset.utils.core import DatasourceType, get_example_default_schema
label_desc: Use image node_id 4 for calling a global function with example usage: create_dashboard(slug, title, position, slices) and returns: dash, dash