'Update current dict with dict1 and then dict2.
This recursively updates the structure of the original dictionary-like
object with the new entries in the second and third objects. This
allows users to update with large, nested structures.
Note, because the dict2 packs up all the keyword arguments, you can
specify the changes as a list of keyword agruments.
Examples:
# update with dict
obj = Layout(title=\'my title\', xaxis=XAxis(range=[0,1], domain=[0,1]))
update_dict = dict(title=\'new title\', xaxis=dict(domain=[0,.8]))
obj.update(update_dict)
obj
{\'title\': \'new title\', \'xaxis\': {\'range\': [0,1], \'domain\': [0,.8]}}
# update with list of keyword arguments
obj = Layout(title=\'my title\', xaxis=XAxis(range=[0,1], domain=[0,1]))
obj.update(title=\'new title\', xaxis=dict(domain=[0,.8]))
obj
{\'title\': \'new title\', \'xaxis\': {\'range\': [0,1], \'domain\': [0,.8]}}
This \'fully\' supports duck-typing in that the call signature is
identical, however this differs slightly from the normal update
method provided by Python\'s dictionaries.'

def update(self, dict1=None, **dict2):

    if (dict1 is not None):
        for (key, val) in list(dict1.items()):
            if (key in self):
                if isinstance(self[key], (PlotlyDict, PlotlyList)):
                    self[key].update(val)
                else:
                    self[key] = val
            else:
                self[key] = val
    if len(dict2):
        for (key, val) in list(dict2.items()):
            if (key in self):
                if isinstance(self[key], (PlotlyDict, PlotlyList)):
                    self[key].update(val)
                else:
                    self[key] = val
            else:
                self[key] = val
