code: def get_datasource_by_id(
      datasource_id: int, datasource_type: str
  ) -> BaseDatasource:
      try:
          return DatasourceDAO.get_datasource(
              db.session, DatasourceType(datasource_type), datasource_id
          )
      except DatasourceNotFound as ex:
          raise DatasourceNotFoundValidationError() from ex
  
file_path: superset/superset/commands/utils.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from flask import g
  from flask_appbuilder.security.sqla.models import Role, User
  from superset import security_manager
  from superset.commands.exceptions import DatasourceNotFoundValidationError, OwnersNotFoundValidationError, RolesNotFoundValidationError
  from superset.daos.datasource import DatasourceDAO
  from superset.daos.exceptions import DatasourceNotFound
  from superset.extensions import db
  from superset.utils.core import DatasourceType, get_user_id
label_desc: Use image node_id 3 for calling a global function with example usage: get_datasource_by_id(datasource_id, datasource_type) and returns: DatasourceDAO