code: def assert_artifact(self, step, name, value, fields=None):
      for task, artifacts in self.artifact_dict(step, name).items():
          if name in artifacts:
              artifact = artifacts[name]
              if fields:
                  for field, v in fields.items():
                      if is_stringish(artifact):
                          data = json.loads(artifact)
                      else:
                          data = artifact
                      if not isinstance(data, dict):
                          raise AssertArtifactFailed(
                              "Task '%s' expected %s to be a dictionary (got %s)"
                              % (task, name, type(data))
                          )
                      if data.get(field, None) != v:
                          raise AssertArtifactFailed(
                              "Task '%s' expected %s[%s]=%r but got %s[%s]=%s"
                              % (
                                  task,
                                  name,
                                  field,
                                  truncate(v),
                                  name,
                                  field,
                                  truncate(data.get(field, None)),
                              )
                          )
              elif artifact != value:
                  raise AssertArtifactFailed(
                      "Task '%s' expected %s=%r but got %s=%s"
                      % (
                          task,
                          name,
                          truncate(value),
                          name,
                          truncate(artifact),
                      )
                  )
          else:
              raise AssertArtifactFailed(
                  "Task '%s' expected %s=%s but "
                  "the key was not found"
                  % (task, name, truncate(value))
              )
      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 4 for calling the MetadataCheck obj's underlying member method code with example usage: obj.assert_artifact(step, name, value, fields) and returns: True