def merge(left, right):
    """This is a deep merge implementation.
  It's called on manifest_table dicts with the intent of merging all of
  them into a superset of all of their contents. The tricky part is that
  the values need to be merged as well."""
    merged = left
    for table_key, table_value in right.items():
        if left.get(table_key):
            for key in table_value.keys():
                if left[table_key].get(key):
                    merged[table_key][key] = merged[table_key][key
                        ] or table_value[key]
        else:
            merged[table_key] = right[table_key]
    return merged
