<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_timestamp(dt):
 """Convert a datetime object to a unix timestamp. Note that unlike a typical unix timestamp, this is seconds since 1970 *local time*, not UTC. If the passed in object is already a timestamp, then that value is simply returned unmodified. """

    if isinstance(dt, int):
        return dt
    return int(total_seconds(dt.replace(tzinfo=None) -
               datetime.datetime(1970, 1, 1)))