human
I wrote the below code

    def add(pid):
        proc = Process(pid)
        if (attrs is not None):
            proc.info = proc.as_dict(attrs=attrs, ad_value=ad_value)
        _pmap[proc.pid] = proc
        return proc
    def remove(pid):
        _pmap.pop(pid, None)
    a = set(pids())
    b = set(_pmap.keys())
    new_pids = (a - b)
    gone_pids = (b - a)
    for pid in gone_pids:
        remove(pid)
    for (pid, proc) in sorted((list(_pmap.items()) + list(dict.fromkeys(new_pids).items()))):
        try:
            if (proc is None):
                (yield add(pid))
            elif proc.is_running():
                if (attrs is not None):
                    proc.info = proc.as_dict(attrs=attrs, ad_value=ad_value)
                (yield proc)
            else:
                (yield add(pid))
        except NoSuchProcess:
            remove(pid)
        except AccessDenied:
            if ((proc is None) and (pid in _pmap)):
                try:
                    (yield _pmap[pid])
                except KeyError:
                    pass
            else:
                raise

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def process_iter(attrs=None, ad_value=None):