<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def get_in_tree_template(link):
 """Get the in-tree json-e template for a given link. By convention, this template is SOURCE_REPO/.taskcluster.yml. Args: link (LinkOfTrust):
 the parent link to get the source url from. Raises: CoTError: on non-yaml `source_url` KeyError: on non-well-formed source template Returns: dict: the first task in the template. """

    context = link.context
    source_url = get_source_url(link)
    if not source_url.endswith(('.yml', '.yaml')):
        raise CoTError("{} source url {} doesn't end in .yml or .yaml!".format(
            link.name, source_url
        ))
    tmpl = await load_json_or_yaml_from_url(
        context, source_url, os.path.join(
            context.config["work_dir"], "{}_taskcluster.yml".format(link.name)
        )
    )
    return tmpl