def filter_to_spec_fields(spec_dict: dict, specification):
    if is_dataclass(specification):
        return {k: v for (k, v) in spec_dict.items() if (k in [f.name for f in fields(specification)])}
    else:
        return spec_dict
def filter_to_spec_fields(spec_dict: dict, specification):
    if is_dataclass(specification):
        return {k: v for (k, v) in spec_dict.items() if (k in [f.name for f in fields(specification)])}
    else:
        return spec_dict