'put path, value into a dict'

def update(self, path, value, index=None, curr_value=None):

    try:
        entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
    except KeyError:
        entry = None
    if isinstance(entry, dict):
        if (not isinstance(value, dict)):
            raise YeditException(('Cannot    replace    key,    value    entry    in    dict    with    non-dict    type.    ' + 'value=[{}]    type=[{}]'.format(value, type(value))))
        entry.update(value)
        return (True, self.yaml_dict)
    elif isinstance(entry, list):
        ind = None
        if curr_value:
            try:
                ind = entry.index(curr_value)
            except ValueError:
                return (False, self.yaml_dict)
        elif (index is not None):
            ind = index
        if ((ind is not None) and (entry[ind] != value)):
            entry[ind] = value
            return (True, self.yaml_dict)
        try:
            ind = entry.index(value)
        except ValueError:
            entry.append(value)
            return (True, self.yaml_dict)
        if (ind is not None):
            return (False, self.yaml_dict)
    return (False, self.yaml_dict)
