def get_rns_from_ec_dict(ec_dict: dict, list_of_ecs=None):
    """get unique list of reactions from ecs in dictionary output by
    `KEGG_parser.downloader.get_kegg_record_dict` that are in
    *list_of_ecs* or all if *list_of_ecs* is None.
    """
    if not list_of_ecs:
        list_of_ecs = ec_dict.keys()
    rns = set()
    for ec in list_of_ecs:
        try:
            ec_record = ec_dict[ec]
            if "ALL_REAC" in ec_record:
                rns.update(ec_record["ALL_REAC"])
        except KeyError:
            pass
    return list(rns)