def duration(start, end=None):
    """
    Returns duration in seconds since supplied time.
    Note: time_delta.total_seconds() only available in python 2.7+

    :param start: datetime object
    :param end: Optional end datetime, None = now
    :returns: Seconds as decimal since start
    """
    if not end:
        end = datetime.now()
    td = end - start
    return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1000000) \
        / 1000000.0