code: def create_database_to_db(name: Optional[str] = None) -> Database:
      database = create_database(name)
      insert_model(database)
      inserted_databases_ids.append(database.id)
      return database
  
imports: import logging
  from typing import Optional
  from flask_appbuilder import Model
  from flask_appbuilder.security.sqla.models import User
  from superset import db
  from superset.connectors.sqla.models import SqlaTable, sqlatable_user
  from superset.models.core import Database
  from superset.models.dashboard import Dashboard, dashboard_slices, dashboard_user, DashboardRoles
  from superset.models.slice import Slice, slice_user
  from tests.integration_tests.dashboards.dashboard_test_utils import random_slug, random_str, random_title
label_desc: Use image node_id 8 for calling a global function with example usage: create_database_to_db(name) and returns: database