code: async def build_task_dependencies(chain, task, name, my_task_id):
      
      log.info("build_task_dependencies {} {}".format(name, my_task_id))
      if name.count(':') > chain.context.config['max_chain_length']:
          raise CoTError("Too deep recursion!\n{}".format(name))
      sorted_dependencies = find_sorted_task_dependencies(task, name, my_task_id)
  
      for task_name, task_id in sorted_dependencies:
          if task_id not in chain.dependent_task_ids():
              link = LinkOfTrust(chain.context, task_name, task_id)
              json_path = link.get_artifact_full_path('task.json')
              try:
                  task_defn = await chain.context.queue.task(task_id)
                  link.task = task_defn
                  chain.links.append(link)
                  # write task json to disk
                  makedirs(os.path.dirname(json_path))
                  with open(json_path, 'w') as fh:
                      fh.write(format_json(task_defn))
                  await build_task_dependencies(chain, task_defn, task_name, task_id)
              except TaskclusterFailure as exc:
                  raise CoTError(str(exc))
docs: Recursively build the task dependencies of a task.
  
      Args:
          chain (ChainOfTrust): the chain of trust to add to.
          task (dict): the task definition to operate on.
          name (str): the name of the task to operate on.
          my_task_id (str): the taskId of the task to operate on.
  
      Raises:
          CoTError: on failure.