def update_copy(d, _new=None, **kw):
 d = d.copy()
 if _new:
  d.update(_new)
 d.update(**kw)
 return d

def update_copy ( d , _new = None , ** kw ) : d = d . copy ( ) if _new : d . update ( _new ) d . update ( ** kw ) return d
copy the given dict and update with the given values .