def merge_errors(self, errors_local, errors_remote):
for prop in errors_remote:<EOL><INDENT>if prop not in errors_local:<EOL><INDENT>errors_local[prop] = errors_remote[prop]<EOL>continue<EOL><DEDENT>local = errors_local[prop]<EOL>local = local.errors if isinstance(local, Result) else local<EOL>remote = errors_remote[prop]<EOL>remote = remote.errors if isinstance(remote, Result) else remote<EOL>if not isinstance(local, type(remote)):<EOL><INDENT>msg = '<STR_LIT>'<EOL>msg += '<STR_LIT>'<EOL>raise x.UnableToMergeResultsType(msg.format(<EOL>prop,<EOL>type(errors_remote[prop]),<EOL>type(self.errors[prop])<EOL>))<EOL><DEDENT>mismatch = '<STR_LIT>'<EOL>mismatch += '<STR_LIT>'<EOL>if '<STR_LIT>' in local and '<STR_LIT>' in remote:<EOL><INDENT>raise x.UnableToMergeResultsType(mismatch.format(prop))<EOL><DEDENT>if '<STR_LIT>' in local and '<STR_LIT>' in remote:<EOL><INDENT>raise x.UnableToMergeResultsType(mismatch.format(prop))<EOL><DEDENT>if type(remote) is list:<EOL><INDENT>errors_local[prop].extend(remote)<EOL>continue<EOL><DEDENT>if '<STR_LIT>' in remote and '<STR_LIT>' in local:<EOL><INDENT>errors_local[prop]['<STR_LIT>'].extend(remote['<STR_LIT>'])<EOL><DEDENT>if '<STR_LIT>' in remote and '<STR_LIT>' in local:<EOL><INDENT>errors_local[prop]['<STR_LIT>'] = self.merge_errors(<EOL>errors_local[prop]['<STR_LIT>'],<EOL>remote['<STR_LIT>']<EOL>)<EOL><DEDENT>if '<STR_LIT>' in remote and '<STR_LIT>' in local:<EOL><INDENT>for index, result in remote['<STR_LIT>'].items():<EOL><INDENT>if index not in local['<STR_LIT>']:<EOL><INDENT>errors_local[prop]['<STR_LIT>'][index] = result<EOL><DEDENT>else:<EOL><INDENT>merged = self.merge_errors(<EOL>errors_local[prop]['<STR_LIT>'][index].errors,<EOL>errors_remote[prop]['<STR_LIT>'][index].errors,<EOL>)<EOL>errors_local[prop]['<STR_LIT>'][index] = merged<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return errors_local<EOL>
Merge errors
Recursively traverses error graph to merge remote errors into local
errors to return a new joined graph.

:param errors_local: dict, local errors, will be updated
:param errors_remote: dict, remote errors, provides updates
:return: dict