time.sleep() expects a float

Also handling case where python < 2.7 (datetime.timedelta.total_seconds is only available since Python >= 2.7)