Get value in dictionary for dictionary[keys[0]][keys[1]][keys[..n]]

    :param dictionary: An input dictionary
    :param keys: Keys where to store data
    :return:
1071
def nested_get(dictionary, keys):
    
    return reduce(lambda d, k: d[k], keys, dictionary)
4237
def str2dict_values(str_in):
    '''
    
    '''
    tmp_dict = str2dict(str_in)
    if tmp_dict is None:
        return None
    return [tmp_dict[key] for key in sorted(k for k in tmp_dict)]
1269583
def getdict(source):
    
    std_dict = {}
    for var, val in source.iteritems():
        std_dict[var] = source[var]
    return std_dict
1085144
def items(self, *keys):
        
        if keys:
            d = []
            for key in keys:
                try:
                    i = self.index(key)
                except KeyError:
                    d.append((key, None))
                else:
                    d.append((self.__keys[i], self[i]))
            return d
        return list((self.__keys[i], super(Record, self).__getitem__(i)) for i in range(len(self)))
209609
def dict_of_lists(self):
        
        result = {}
        for key, value in self._items:
            if key in result:
                result[key].append(value)
            else:
                result[key] = [value]
        return result
692923
def get(self, key=NOT_SET, index=NOT_SET, d=None):
		
		if index is NOT_SET and key is not NOT_SET:
			try:
				index, value = self._dict[key]
			except KeyError:
				return d
			else:
				return value
		elif index is not NOT_SET and key is NOT_SET:
			try:
				key, value = self._list[index]
			except IndexError:
				return d
			else:
				return value
		else:
			raise KEY_EQ_INDEX_ERROR
525217
def values(self, key_type=None):
        
        if(key_type is not None):
            all_items = {} # in order to preserve keys() type (dict_values for python3) 
            keys_used = set()
            direct_key = str(key_type)
            if direct_key in self.__dict__:
                for intermediate_key in self.__dict__[direct_key].values():
                    if not intermediate_key in keys_used:
                        all_items[intermediate_key] = self.items_dict[intermediate_key]
                        keys_used.add(intermediate_key)
            return all_items.values()
        else:
            return self.items_dict.values()
1275699
def _dict_values_sorted_by_key(dictionary):
    # This should be a yield from instead.
    
    for _, value in sorted(dictionary.iteritems(), key=operator.itemgetter(0)):
        yield value
262646
def keys_with_value(dictionary, value):
        ""

        subset = [key for key in dictionary if dictionary[key] == value]

        return subset
229041
def _filter_keys(d: dict, keys: set) -> dict:
        
        return {key: d[key] for key in keys if key in d}
915785
def value(self, key, default=None):
        
        curr = self._stack[-1]
        return curr.get(key, default)
614254
def str2dict_keys(str_in):
    '''
    
    '''
    tmp_dict = str2dict(str_in)
    if tmp_dict is None:
        return None
    return sorted([k for k in tmp_dict])
734078
def get_dictkey(In, k, dtype):
    

    Out = []
    for d in In:
        if dtype == '':
            Out.append(d[k])
        if dtype == 'f':
            if d[k] == "":
                Out.append(0)
            elif d[k] == None:
                Out.append(0)
            else:
                Out.append(float(d[k]))
        if dtype == 'int':
            if d[k] == "":
                Out.append(0)
            elif d[k] == None:
                Out.append(0)
            else:
                Out.append(int(d[k]))
    return Out
992154
def get(self, key, default=None):
        
        if key in self:
            return self.items_dict[self.__dict__[str(type(key))][key]]
        else:
            return default
139817
def valid_dict(d, keys=None):
    

    if keys is None:
        d_ = d
    else:
        d_ = itemfilter(lambda item: item[0] in keys, d)
        if len(d_) != len(keys):
            return False
    values = list(itervalues(d_))
    return False if None in values else True
297347
def from_dict(self, values):
        
        for k in values.keys():
            setattr(self, k, values[k])
462195
def _check_keys(dictionary):
    
    for key in dictionary:
        if isinstance(dictionary[key], matlab.mio5_params.mat_struct):
            dictionary[key] = _todict(dictionary[key])
    return dictionary