def copy_struct(dst, src, repl={}):
 repl = repl.copy()
 for k in src._datamodel._fields:
  v = repl.pop(k, getattr(src, k))
  setattr(dst, k, v)
 for (k, v) in repl.items():
  setattr(dst, k, v)
 return dst

def copy_struct ( dst , src , repl = { } ) : repl = repl . copy ( ) for k in src . _datamodel . _fields : v = repl . pop ( k , getattr ( src , k ) ) setattr ( dst , k , v ) for ( k , v ) in repl . items ( ) : setattr ( dst , k , v ) return dst
copy structure from *src* to *dst* with replacement from *repl* .