{**a, **b, **c}result = []
for c in collections:
    inced = 0
    for n, collection in enumerate(result):
        if collection["href"] == c["href"]: 
            result[n]["wait"] += c["wait"]
            inced = 1
    if inced == 0: result.append(c)result = []
for c in collections:
    for n, collection in enumerate(result):
        if collection["href"] == c["href"]: 
            result[n]["wait"] += c["wait"]
            break
    else: result.append(c) 
  
  $arBasketItems = [];
foreach($arItems as $key => $val){
	foreach($arBasketItems as $key1 => $val1)
		if($val1['NAME'] == $val['NAME'] || $val1['EXTERNAL_CODE'] == $val['EXTERNAL_CODE'] ){
			$arBasketItems[$key1]['COUNT']++;
			goto end;
		}
	array_push($arBasketItems,['NAME' => $val['NAME'],'EXTERNAL_CODE' => $val['NAME'], 'COUNT' => 1]);
	end:
}$result = [];
foreach ($arBasketItems as $d) {
    if (!isset($result[$d['NAME']])) {
        $result[$d['NAME']] = $d;
        $result[$d['NAME']]['count'] = 0;
    }
    $result[$d['NAME']]['count']++;
}
$result = array_values($result); 
  
   
  
  from time import time, sleep
from operator import attrgetter
class Article:
    def __init__(self, timestamp, text):
        self.timestamp, self.text = timestamp, text
    def post(self):
        print(f"planned={self.timestamp:.0f}, posted={time():.0f}, text={self.text}")
class Scheduler:
    
    def __init__(self, *articles):
        self.articles = sorted(articles, key=attrgetter("timestamp"))
    def execute(self):
        for article in self.articles:
            sleep(max(article.timestamp - time(), 0))
            article.post()
if __name__ == "__main__":
    now = time()
    Scheduler(
        Article(now + 7, "post3"),
        Article(now + 2, "post1"),
        Article(now + 3, "post2"),
    ).execute()