code: def get_num_train_examples(
      task_cache_dict: Dict, train_task_list=None
  ) -> Dict[str, int]:
      """Count training examples for tasks.
  
      Args:
          task_cache_dict: nested maps from task name to phases, and from phase to task cache object.
          train_task_list (List): list of task names for which to count training examples.
  
      Notes:
          If get_num_train_examples() is called without providing train_task_list, training examples
          for all tasks in task_cache_dict are counted by get_num_train_examples().
  
      Returns:
          Dict[str, int] mapping task names to the count of training examples for that task.
  
      """
      num_train_examples_dict = {}
      if train_task_list is None:
          train_task_list = list(task_cache_dict)
      for task_name in train_task_list:
          single_task_cache_dict = task_cache_dict[task_name]
          if "train" in single_task_cache_dict:
              num_train_examples_dict[task_name] = len(
                  single_task_cache_dict["train"]
              )
          else:
              num_train_examples_dict[task_name] = 0
      return num_train_examples_dict
  
imports: import warnings
  from dataclasses import dataclass
  from typing import Dict, List, Optional
  import jiant.proj.main.components.task_sampler
  import jiant.shared.caching
  from jiant.tasks.core import Task
  from jiant.tasks.retrieval import create_task_from_config_path
  import jiant.utils.python.io
  from jiant.utils.python.datastructures import ExtendedDataClassMixin
label_desc: Use image node_id 3 for calling a global function with example usage: get_num_train_examples(task_cache_dict, train_task_list) and returns: num_train_examples_dict