def get_service_dependency_tree(yml_dict, run_exclude_images):
    """Method to generate a dict of services and services it depends on 

    :param yml_dict: dict generated from docker-compose yml
    :type yml_dict: dict
    :param run_exclude_images: List of name of dependency services which
                               are excluded from run
    :type run_exclude_images: array
    :return dep_tree: the dependency tree dict
    :rtype: dict
    """
    dep_tree = {}
    for k, v in yml_dict.items():
        if(k == "services"):
            for service, service_dict in v.items():
                if service not in run_exclude_images:
                    dep_tree[service] = []
                for service_key, service_vals in list(service_dict.items()):
                    if service_key == "depends_on":
                        dep_tree[service] = service_vals
    return dep_tree