def _get_depended_demands(self, _open_demand_list, _request):
    demand_list = []
    while True:
        if (len(_open_demand_list) == 0):
            break
        d = _open_demand_list.pop(0)
        if (d.sort_base != 1):
            d.sort_base = 1
        demand_list.append(d)
        for key in _request.constraints:
            c = _request.constraints[key]
            if (c.constraint_type == 'aic_distance'):
                if (d.name in c.demand_list):
                    for dk in c.demand_list:
                        if ((dk != d.name) and (_request.demands[dk].sort_base != 1)):
                            _request.demands[dk].sort_base = 1
                            _open_demand_list.append(_request.demands[dk])
        for op in _request.objective.operand_list:
            if (op.function.func_type == 'latency_between'):
                if (op.function.loc_a.name == d.name):
                    if (op.function.loc_z.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_z.name].sort_base != 1):
                            _request.demands[op.function.loc_z.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_z)
                elif (op.function.loc_z.name == d.name):
                    if (op.function.loc_a.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_a.name].sort_base != 1):
                            _request.demands[op.function.loc_a.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_a)
            elif (op.function.func_type == 'distance_between'):
                if (op.function.loc_a.name == d.name):
                    if (op.function.loc_z.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_z.name].sort_base != 1):
                            _request.demands[op.function.loc_z.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_z)
                elif (op.function.loc_z.name == d.name):
                    if (op.function.loc_a.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_a.name].sort_base != 1):
                            _request.demands[op.function.loc_a.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_a)
    return demand_list
def _get_depended_demands(self, _open_demand_list, _request):
    demand_list = []
    while True:
        if (len(_open_demand_list) == 0):
            break
        d = _open_demand_list.pop(0)
        if (d.sort_base != 1):
            d.sort_base = 1
        demand_list.append(d)
        for key in _request.constraints:
            c = _request.constraints[key]
            if (c.constraint_type == 'aic_distance'):
                if (d.name in c.demand_list):
                    for dk in c.demand_list:
                        if ((dk != d.name) and (_request.demands[dk].sort_base != 1)):
                            _request.demands[dk].sort_base = 1
                            _open_demand_list.append(_request.demands[dk])
        for op in _request.objective.operand_list:
            if (op.function.func_type == 'latency_between'):
                if (op.function.loc_a.name == d.name):
                    if (op.function.loc_z.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_z.name].sort_base != 1):
                            _request.demands[op.function.loc_z.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_z)
                elif (op.function.loc_z.name == d.name):
                    if (op.function.loc_a.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_a.name].sort_base != 1):
                            _request.demands[op.function.loc_a.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_a)
            elif (op.function.func_type == 'distance_between'):
                if (op.function.loc_a.name == d.name):
                    if (op.function.loc_z.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_z.name].sort_base != 1):
                            _request.demands[op.function.loc_z.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_z)
                elif (op.function.loc_z.name == d.name):
                    if (op.function.loc_a.name in _request.demands.keys()):
                        if (_request.demands[op.function.loc_a.name].sort_base != 1):
                            _request.demands[op.function.loc_a.name].sort_base = 1
                            _open_demand_list.append(op.function.loc_a)
    return demand_list