#NEWLINE# def pids( check = None , name = None ) : #NEWLINE# #INDENT# from psutil import process_iter #NEWLINE# if ( check == 'wholelist' ) : #NEWLINE# #INDENT# print ( '' ) #NEWLINE# for p in process_iter ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# print ( '\tPID: {0}  \t\t {1}' . format ( p . pid , p . name ( ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# print ( '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cache = None #NEWLINE# print ( '' ) #NEWLINE# for p in process_iter ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( name . lower ( ) in p . name ( ) . lower ( ) ) : #NEWLINE# #INDENT# cache = True #NEWLINE# print ( '\tPID: {0}  \t\t {1}' . format ( p . pid , p . name ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# print ( '' ) #NEWLINE# if ( cache == None ) : #NEWLINE# #INDENT# print ( 'PID not founded for : {0} ' . format ( check ) )