def datetime_utc_to_local(utc):
<EOL>ts = time.time()<EOL>cur = datetime.datetime.fromtimestamp(ts)<EOL>cur_utc = datetime.datetime.utcfromtimestamp(ts)<EOL>offset = cur - cur_utc<EOL>t = utc<EOL>d = datetime.timedelta(hours = <NUM_LIT:2>)<EOL>while d > _MINUTE:<EOL><INDENT>local = t + offset<EOL>tm = local.timetuple()<EOL>tm = tm[<NUM_LIT:0>:<NUM_LIT:8>] + (<NUM_LIT:0>, )<EOL>ts = time.mktime(tm)<EOL>u = datetime.datetime.utcfromtimestamp(ts)<EOL>diff = u - utc<EOL>if diff < _MINUTE and diff > -_MINUTE:<EOL><INDENT>break<EOL><DEDENT>if diff > _NULLDELTA:<EOL><INDENT>offset -= d<EOL><DEDENT>else:<EOL><INDENT>offset += d<EOL><DEDENT>d //= <NUM_LIT:2><EOL><DEDENT>return local<EOL>
An ugly hack to convert naive :std:`datetime.datetime` object containing
UTC time to a naive :std:`datetime.datetime` object with local time.
It seems standard Python 2.3 library doesn't provide any better way to
do that.