# Path: bom/utils.py
# def get_from_dict(input_dict, key_options):
#     for key in key_options:
#         val = input_dict.get(key, None)
#         if val:
#             return val
#     return None


from abc import ABC
from .utils import get_from_dict
            else:
                for syn in defn.name_options:
                    if hdr_name == syn:
                        k = defn.keys()
                        return k + defn.name_options

    # If header name does not have a default (i.e., it is not a valid header name) then
    # returns None.
    def get_default(self, hdr_name):
        synonyms = self.get_synoynms(hdr_name)
        return self.get_synoynms(hdr_name)[0] if synonyms is not None else None

    # Preserves order of definitions as listed in all_header_defns:
    def get_default_all(self):
        return [d.name for d in self.all_headers_defns]

    # Given a list of header names returns the default name for each. The return list
    # matches the order of the input list. If a name is not recognized, then returns
    # None as its default:
    def get_defaults_list(self, hdr_names):
        defaults_list = []
        for hdr_name in hdr_names:
            defaults_list.append(self.get_default(hdr_name))
        return defaults_list

    def is_valid(self, hdr_name):
        return self.get_synoynms(hdr_name) is not None

    def get_val_from_row(self, input_dict, hdr_name):
        synonyms = self.get_synoynms(hdr_name)

# Path: bom/utils.py
# def get_from_dict(input_dict, key_options):
#     for key in key_options:
#         val = input_dict.get(key, None)
#         if val:
#             return val
#     return None


# Path: bom/csv_headers.py
from abc import ABC
from .utils import get_from_dict

            else:
                for syn in defn.name_options:
                    if hdr_name == syn:
                        k = defn.keys()
                        return k + defn.name_options

    # If header name does not have a default (i.e., it is not a valid header name) then
    # returns None.
    def get_default(self, hdr_name):
        synonyms = self.get_synoynms(hdr_name)
        return self.get_synoynms(hdr_name)[0] if synonyms is not None else None

    # Preserves order of definitions as listed in all_header_defns:
    def get_default_all(self):
        return [d.name for d in self.all_headers_defns]

    # Given a list of header names returns the default name for each. The return list
    # matches the order of the input list. If a name is not recognized, then returns
    # None as its default:
    def get_defaults_list(self, hdr_names):
        defaults_list = []
        for hdr_name in hdr_names:
            defaults_list.append(self.get_default(hdr_name))
        return defaults_list

    def is_valid(self, hdr_name):
        return self.get_synoynms(hdr_name) is not None

    def get_val_from_row(self, input_dict, hdr_name):
        synonyms = self.get_synoynms(hdr_name)

        return get_from_dict(input_dict, synonyms) if synonyms is not None else None