def mergeDicts( d1, d2 ):
   r = {}
   r.update( d1 )

   for key in d2:
      value = d2[ key ]

      if key in d1:
         if isinstance( value, SubStyle ):
            value = value.kwargs()

         if isinstance( value, dict ) and ( key in d1 ):
            other = d1[ key ]

            if isinstance( other, SubStyle ):
               other = other.kwargs()

            value = mergeDicts( other, value )

      r[ key ] = value

   return r

#===========================================================================
# For internal use only.
Cast model to Python structure.
dataset/ETHPy150Open nasa/mplStyle/mplStyle/types/lib.py/mergeDicts--crossover with--dataset/ETHPy150Open beregond/jsonmodels/jsonmodels/models.py/Base.to_struct