code: def assert_card(
      self,
      step,
      task,
      card_type,
      value,
      card_hash=None,
      card_id=None,
      exact_match=True,
  ):
      from metaflow.plugins.cards.exception import (
          CardNotPresentException,
      )
  
      try:
          card_iter = self.get_card(
              step, task, card_type, card_id=card_id
          )
      except CardNotPresentException:
          card_iter = None
      card_data = None
      # Since there are many cards possible for a taskspec, we check for hash to assert a single card.
      # If the id argument is present then there will be a single cards anyway.
      if card_iter is not None:
          if len(card_iter) > 0:
              if card_hash is None:
                  card_data = card_iter[0].get()
              else:
                  card_filter = [
                      c for c in card_iter if card_hash in c.hash
                  ]
                  card_data = (
                      None
                      if len(card_filter) == 0
                      else card_filter[0].get()
                  )
      if (exact_match and card_data != value) or (
          not exact_match and value not in card_data
      ):
          raise AssertCardFailed(
              "Task '%s/%s' expected %s card with content '%s' but got '%s'"
              % (
                  self.run_id,
                  step,
                  card_type,
                  repr(value),
                  repr(card_data),
              )
          )
      return True
  
imports: import json
  import os
  from metaflow.util import is_stringish
  from .None import MetaflowCheck, AssertArtifactFailed, AssertCardFailed, AssertLogFailed, assert_equals, assert_exception, truncate
label_desc: Use image node_id 9 for calling the MetadataCheck obj's underlying member method code with example usage: obj.assert_card(step, task, card_type, value, card_hash, card_id, exact_match) and returns: True