code: def cards_for_task(
      flow_datastore,
      task_pathspec,
      card_type=None,
      card_hash=None,
      card_id=None,
  ):
      try:
          paths, card_ds = resolve_paths_from_task(
              flow_datastore,
              task_pathspec,
              type=card_type,
              hash=card_hash,
              card_id=card_id,
          )
      except CardNotPresentException:
          return None
      for card in CardContainer(paths, card_ds, origin_pathspec=None):
          yield card
  
imports: import os
  import json
  from http.server import BaseHTTPRequestHandler
  from threading import Thread
  from multiprocessing import Pipe
  from multiprocessing.connection import Connection
  from urllib.parse import urlparse
  import time
  from .card_client import CardContainer
  from .exception import CardNotPresentException
  from .card_resolver import resolve_paths_from_task
  from metaflow.metaflow_config import DATASTORE_LOCAL_DIR
  from metaflow import namespace
  from metaflow.exception import CommandException, MetaflowNotFound, MetaflowNamespaceMismatch
label_desc: Use image node_id 1 for calling a global function with example usage: cards_for_task(flow_datastore, task_pathspec, card_type, card_hash, card_id) and returns: None