code: def dump_db(orion_db, db):
      """Dump database if necessary"""
      if isinstance(orion_db, EphemeralDB):
          pass
      elif isinstance(orion_db, MongoDB):
          pass
      elif isinstance(orion_db, PickledDB):
          ephemeral_db = orion_db._get_database()
          ephemeral_db._db = db
          orion_db._dump_database(ephemeral_db)
      else:
          raise TypeError("Invalid database type")
  
imports: import pickle
  from datetime import datetime
  import pytest
  from orion.core.io.database import Database, DatabaseError, DuplicateKeyError
  from orion.core.io.database.ephemeraldb import EphemeralDB
  from orion.core.io.database.mongodb import MongoDB
  from orion.core.io.database.pickleddb import PickledDB
  from .conftest import insert_test_collection
label_desc: Use image node_id 2 for calling a global function with example usage: dump_db(orion_db, db) without return types