code: def _get_flow_datastore(task):
      flow_name = task.pathspec.split("/")[0]
      # Resolve datastore type
      ds_type = None
      # We need to set the correct datastore root here so that
      # we can ensure that the card client picks up the correct path to the cards
  
      meta_dict = task.metadata_dict
      ds_type = meta_dict.get("ds-type", None)
  
      if ds_type is None:
          raise UnresolvableDatastoreException(task)
  
      ds_root = meta_dict.get("ds-root", None)
      if ds_root:
          ds_root = os.path.join(ds_root, CARD_SUFFIX)
      else:
          ds_root = CardDatastore.get_storage_root(ds_type)
  
      # Delay load to prevent circular dep
      from metaflow.plugins import DATASTORES
  
      storage_impl = [d for d in DATASTORES if d.TYPE == ds_type][0]
      return FlowDataStore(
          flow_name=flow_name,
          environment=None,  # TODO: Add environment here
          storage_impl=storage_impl,
          # ! ds root cannot be none otherwise `list_content`
          # ! method fails in the datastore abstraction.
          ds_root=ds_root,
      )
  
imports: from typing import Optional, Union, TYPE_CHECKING
  from metaflow.datastore import FlowDataStore
  from metaflow.metaflow_config import CARD_SUFFIX
  from .card_resolver import resolve_paths_from_task, resumed_info
  from .card_datastore import CardDatastore, CardNameSuffix
  from .exception import UnresolvableDatastoreException, IncorrectArgumentException, IncorrectPathspecException
  import os
  import tempfile
  import uuid
label_desc: Use image node_id 2 for calling a global function with example usage: _get_flow_datastore(task) and returns: FlowDataStore