code: def _filter_datasets(all_ds, names_or_ids):
      """Help filtering DataIDs by name or DataQuery."""
      # DataID will match a str to the name
      # need to separate them out
      str_filter = [
          ds_name
          for ds_name in names_or_ids
          if isinstance(ds_name, str)
      ]
      id_filter = [
          ds_id for ds_id in names_or_ids if not isinstance(ds_id, str)
      ]
      for ds_id in all_ds:
          if ds_id in id_filter or ds_id["name"] in str_filter:
              yield ds_id
  
imports: from contextlib import contextmanager
  from datetime import datetime
  from typing import Any
  from unittest import mock
  import dask.array
  import numpy
  from pyresample import create_area_def
  from pyresample.geometry import BaseDefinition, SwathDefinition
  from xarray import DataArray
  from satpy import Scene
  from satpy.composites import GenericCompositor, IncompatibleAreas
  from satpy.dataset import DataID, DataQuery
  from satpy.dataset.dataid import default_id_keys_config, minimal_default_keys_config
  from satpy.modifiers import ModifierBase
  from satpy.readers.file_handlers import BaseFileHandler
label_desc: Use image node_id 6 for calling a global function with example usage: _filter_datasets(all_ds, names_or_ids) without return types