Print ping exit statistics

def exit_statistics(hostname, start_time, count_sent, count_received, min_time, avg_time, max_time, deviation):
    """
    Print ping exit statistics
    """
    end_time = datetime.datetime.now()
    duration = end_time - start_time
    duration_sec = float(duration.seconds * 1000)
    duration_ms = float(duration.microseconds / 1000)
    duration = duration_sec + duration_ms
    package_loss = 100 - ((float(count_received) / float(count_sent)) * 100)
    print(f'\b\b--- {hostname} ping statistics ---')
    try:
        print(f'{count_sent} packages transmitted, {count_received} received, {package_loss}% package loss, time {duration}ms')
    except ZeroDivisionError:
        print(f'{count_sent} packets transmitted, {count_received} received, 100% packet loss, time {duration}ms')
    print(
        'rtt min/avg/max/dev = %.2f/%.2f/%.2f/%.2f ms' % (
            min_time.seconds*1000 + float(min_time.microseconds)/1000,
            float(avg_time) / 1000,
            max_time.seconds*1000 + float(max_time.microseconds)/1000,
            float(deviation)
        )
    )