def total_seconds(td):
    """Return the total number of seconds contained in the duration.

    NOTE(andreykurilin): python 2.6 compatible method
    """
    if hasattr(td, "total_seconds"):
        s = td.total_seconds()
    else:
        # NOTE(andreykurilin): next calculation is proposed in python docs
        # https://docs.python.org/2/library/datetime.html#datetime.timedelta.total_seconds
        s = (td.microseconds +
             (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10.0 ** 6
    return "%.3f" % s
dataset/ETHPy150Open openstack/rally/rally/common/io/subunit_v2.py/total_seconds/original