def listpid(toggle='basic'): # Add method to exclude elements from list
    '''list pids'''
    proc=psutil.process_iter()# evalute if its better to keep one instance of this or generate here?
    if toggle=='basic':
        host=gethostname()
        host2=os.getenv('HOME').split(sep='/'   )[-1]
        for row in proc:
            #~ DPRINT([row.ppid(),row.name(),host],'username,row.name,host')
            if row.username() in host or row.username() in host2:   #new psutil using grabing timeyyy and not alfa for username so host 2 is getting the timeyyy on UBUNTU  
                yield row.name(), row.ppid()
    elif toggle=='all':
        for row in proc:
            
            yield row.name(), row.ppid()
    elif toggle =='windows-basic':
        for row in proc:
            try:
                pname = psutil.Process(row.pid).name()
                pname = pname[:-4]#removiing .exe from end
                yield pname, row.pid
            except:
                pass
def listpid ( toggle = 'basic' ) : proc = psutil . process_iter ( ) if toggle == 'basic' : host = gethostname ( ) host2 = os . getenv ( 'HOME' ) . split ( sep = '/' ) [ - 1 ] for row in proc : if row . username ( ) in host or row . username ( ) in host2 : yield row . name ( ) , row . ppid ( ) elif toggle == 'all' : for row in proc : yield row . name ( ) , row . ppid ( ) elif toggle == 'windows-basic' : for row in proc : try : pname = psutil . Process ( row . pid ) . name ( ) pname = pname [ : - 4 ] yield pname , row . pid except : pass
list pids