def new_datetime(d):
 kw = [d.year, d.month, d.day]
 if isinstance(d, real_datetime):
  kw.extend([d.hour, d.minute, d.second, d.microsecond, d.tzinfo])
 return datetime(*kw)

def new_datetime ( d ) : kw = [ d . year , d . month , d . day ] if isinstance ( d , real_datetime ) : kw . extend ( [ d . hour , d . minute , d . second , d . microsecond , d . tzinfo ] ) return datetime ( * kw )
generate a safe datetime from a datetime .