from typing import Dict
from typing import Any
from typing import List
import yaml


def insert_worker(worker: Dict[str, Any], workers: List[Dict[str,
                                                             Any]]) -> None:
    """Inserts client or server into a list, without inserting duplicates."""

    def dump(w):
        return yaml.dump(w, Dumper=yaml.SafeDumper, default_flow_style=False)

    worker_str = dump(worker)
    if any((worker_str == dump(w) for w in workers)):
        return
    workers.append(worker)