import calendar


def datetime_to_timestamp(utc_dt):
    """Returns UTC datetime as a POSIX timestamp (seconds since epoch).

    Args:
        utc_dt: a datetime.datetime object storing a UTC date and time.
    Returns:
        The UTC date and time as whole seconds since epoch. Leap seconds
        (utc_dt.second > 59) are "collapsed" to the last non-leap second (59),
        since POSIX timestamps (AKA "Unix time") collapse leap seconds in this
        way by definition, see also:
            http://en.wikipedia.org/wiki/Unix_time#Leap_seconds
    """
    no_leap_second = min(59, utc_dt.second)
    no_leap_dt = utc_dt.replace(second=no_leap_second)
    return calendar.timegm(utc_dt.utctimetuple())