def total_seconds(td):
    """
    simulates the total_seconds function added in python 3.2+ and 2.7+
    See
    :param td: timedelta
    :type td: timedelta
    :return: int representing total seconds from timedelta
    :rtype: int
    """
    return int((td.seconds + td.days * 24 * 3600) * 10 ** 6 / 10 ** 6)
