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

    """Return a float representing the current system-wide CPU
    utilization as a percentage.
    When *interval* is > 0.0 compares system CPU times elapsed before
    and after the interval (blocking).
    When *interval* is 0.0 or None compares system CPU times elapsed
    since last call or module import, returning immediately (non
    blocking). That means the first time this is called it will
    return a meaningless 0.0 value which you should ignore.
    In this case is recommended for accuracy that this function be
    called with at least 0.1 seconds between calls.
    When *percpu* is True returns a list of floats representing the
    utilization as a percentage for each CPU.
    First element of the list refers to first CPU, second element
    to second CPU and so on.
    The order of the list is consistent across calls.
    Examples:
    >>> # blocking, system-wide
    >>> psutil.cpu_percent(interval=1)
    2.0
    >>> # blocking, per-cpu
    >>> psutil.cpu_percent(interval=1, percpu=True)
    [2.0, 1.0]
    >>> # non-blocking (percentage since last call)
    >>> psutil.cpu_percent(interval=None)
    2.9
    """
    global _last_cpu_times
    global _last_per_cpu_times
    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):
        t1_all = _cpu_tot_time(t1)
        t1_busy = _cpu_busy_time(t1)
        t2_all = _cpu_tot_time(t2)
        t2_busy = _cpu_busy_time(t2)
        if (t2_busy <= t1_busy):
            return 0.0
        busy_delta = (t2_busy - t1_busy)
        all_delta = (t2_all - t1_all)
        try:
            busy_perc = ((busy_delta / all_delta) * 100)
        except ZeroDivisionError:
            return 0.0
        else:
            return round(busy_perc, 1)
    if (not percpu):
        if blocking:
            t1 = cpu_times()
            time.sleep(interval)
        else:
            t1 = _last_cpu_times
            if (t1 is None):
                t1 = cpu_times()
        _last_cpu_times = cpu_times()
        return calculate(t1, _last_cpu_times)
    else:
        ret = []
        if blocking:
            tot1 = cpu_times(percpu=True)
            time.sleep(interval)
        else:
            tot1 = _last_per_cpu_times
            if (tot1 is None):
                tot1 = cpu_times(percpu=True)
        _last_per_cpu_times = cpu_times(percpu=True)
        for (t1, t2) in zip(tot1, _last_per_cpu_times):
            ret.append(calculate(t1, t2))
        return ret