human
Complete this python program:
def cpu_times_percent(interval=None, percpu=False):
assistant
#Here is the Python program you requested.

    """Same as cpu_percent() but provides utilization percentages
    for each specific CPU time as is returned by cpu_times().
    For instance, on Linux we\ll get:
    >>> cpu_times_percent()
    cpupercent(user=4.8, nice=0.0, system=4.8, idle=90.5, iowait=0.0,
    irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
    *interval* and *percpu* arguments have the same meaning as in
    cpu_percent().
    """
    global _last_cpu_times_2
    global _last_per_cpu_times_2
    blocking = ((interval is not None) and (interval > 0.0))
    if ((interval is not None) and (interval < 0)):
        raise ValueError(('interval    is    not    positive    (got    %r)' % interval))
    def calculate(t1, t2):
        nums = []
        all_delta = (_cpu_tot_time(t2) - _cpu_tot_time(t1))
        for field in t1._fields:
            field_delta = (getattr(t2, field) - getattr(t1, field))
            try:
                field_perc = ((100 * field_delta) / all_delta)
            except ZeroDivisionError:
                field_perc = 0.0
            field_perc = round(field_perc, 1)
            if (field_perc > 100.0):
                field_perc = 100.0
            elif (field_perc <= 0.0):
                field_perc = 0.0
            nums.append(field_perc)
        return _psplatform.scputimes(*nums)
    if (not percpu):
        if blocking:
            t1 = cpu_times()
            time.sleep(interval)
        else:
            t1 = _last_cpu_times_2
            if (t1 is None):
                t1 = cpu_times()
        _last_cpu_times_2 = cpu_times()
        return calculate(t1, _last_cpu_times_2)
    else:
        ret = []
        if blocking:
            tot1 = cpu_times(percpu=True)
            time.sleep(interval)
        else:
            tot1 = _last_per_cpu_times_2
            if (tot1 is None):
                tot1 = cpu_times(percpu=True)
        _last_per_cpu_times_2 = cpu_times(percpu=True)
        for (t1, t2) in zip(tot1, _last_per_cpu_times_2):
            ret.append(calculate(t1, t2))
        return ret