spiketools.utils.base.check_keys

spiketools.utils.base.check_keys(indict, lst)[source]

Check a dictionary for a set of keys.

Parameters:
indictdict

Dictionary to check keys of.

lstlist

List of keys to check in the dictionary.

Returns:
str or None

Key label that was found in the dictionary, or None if no specified keys found.

Notes

If more than one of the specified keys are in the dictionary, the first one is returned.

Examples

Check which key is defined in dictionary:

>>> dictionary = {'spike_name' : 'a1', 'spike_type' : 0}
>>> lst = ['spike_name', 'spike_label']
>>> check_keys(dictionary, lst)
'spike_name'