def fill_in(at, basedate, units=adatetime.units):
 if isinstance(at, datetime):
  return at
 args = {}
 for unit in units:
  v = getattr(at, unit)
  if (v is None):
   v = getattr(basedate, unit)
  args[unit] = v
 return fix(adatetime(**args))

def fill_in ( at , basedate , units = adatetime . units ) : if isinstance ( at , datetime ) : return at args = { } for unit in units : v = getattr ( at , unit ) if ( v is None ) : v = getattr ( basedate , unit ) args [ unit ] = v return fix ( adatetime ( ** args ) )
returns a copy of at with any unspecified units filled in with values from basedate .