code: def create_task_payload(build, base_context):
      print("build", build)
      build_type = os.path.splitext(os.path.basename(build))[0]
  
      build_context = defaultValues_build_context()
      with open(build) as src:
          build_context["build"].update(yaml.safe_load(src)["build"])
  
      # Be able to use what has been defined in base_context
      # e.g., the {${event.head.branch}}
      build_context = jsone.render(build_context, base_context)
      template_context = {
          "taskcluster": {"taskId": as_slugid(build_type)},
          "build_type": build_type,
      }
  
      with open(
          os.path.join(
              TASKS_ROOT, build_context["build"]["template_file"]
          )
      ) as src:
          template = yaml.safe_load(src)
  
      contextes = merge_dicts(
          {}, base_context, template_context, build_context
      )
      for one_context in glob(os.path.join(TASKS_ROOT, "*.cyml")):
          with open(one_context) as src:
              contextes = merge_dicts(contextes, yaml.safe_load(src))
  
      return jsone.render(template, contextes)
  
imports: from __future__ import absolute_import, print_function, unicode_literals
  from glob import glob
  from functools import reduce
  import json
  import jsone
  import os
  import sys
  import requests
  import slugid
  import yaml
  import subprocess
  import networkx
label_desc: Use image node_id 7 for calling a global function with example usage: create_task_payload(build, base_context) and returns: jsone