code: def is_artifact_optional(chain, task_id, path):
      
      upstream_artifacts = chain.task['payload'].get('upstreamArtifacts', [])
      optional_artifacts_per_task_id = get_optional_artifacts_per_task_id(upstream_artifacts)
      return path in optional_artifacts_per_task_id.get(task_id, [])
docs: Tells whether an artifact is flagged as optional or not.
  
      Args:
          chain (ChainOfTrust): the chain of trust object
          task_id (str): the id of the aforementioned task
  
      Returns:
          bool: True if artifact is optional