def timedelta_seconds(td):
try:<EOL><INDENT>return int(round(td.total_seconds()))<EOL><DEDENT>except AttributeError:<EOL><INDENT>days = td.days<EOL>seconds = td.seconds<EOL>microseconds = td.microseconds<EOL>return int(round((days * <NUM_LIT>) + seconds + (microseconds / <NUM_LIT>)))<EOL><DEDENT>
Return the offset stored by a :class:`datetime.timedelta` object as an
integer number of seconds.  Microseconds, if present, are rounded to
the nearest second.

Delegates to
:meth:`timedelta.total_seconds() <datetime.timedelta.total_seconds()>`
if available.

>>> timedelta_seconds(timedelta(hours=1))
3600
>>> timedelta_seconds(timedelta(hours=-1))
-3600
>>> timedelta_seconds(timedelta(hours=1, minutes=30))
5400
>>> timedelta_seconds(timedelta(hours=1, minutes=30,
... microseconds=300000))
5400
>>> timedelta_seconds(timedelta(hours=1, minutes=30,
...	microseconds=900000))
5401