def getProcDict(self, fields=('<STR_LIT:user>', '<STR_LIT>',), threads=False, **kwargs):
stats = {}<EOL>field_list = list(fields)<EOL>num_cols = len(field_list)<EOL>if threads:<EOL><INDENT>key = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>key = '<STR_LIT>'<EOL><DEDENT>try:<EOL><INDENT>key_idx = field_list.index(key)<EOL><DEDENT>except ValueError:<EOL><INDENT>field_list.append(key)<EOL>key_idx = len(field_list) - <NUM_LIT:1><EOL><DEDENT>result = self.getProcList(field_list, threads, **kwargs)<EOL>if result is not None:<EOL><INDENT>headers = result['<STR_LIT>'][:num_cols]<EOL>lines = result['<STR_LIT>']<EOL>if len(lines) > <NUM_LIT:1>:<EOL><INDENT>for cols in lines:<EOL><INDENT>stats[cols[key_idx]] = dict(zip(headers, cols[:num_cols]))<EOL><DEDENT><DEDENT>return stats<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
Execute ps command with custom output format with columns format with 
        columns from fields, and return result as a nested dictionary with 
        the key PID or SPID.

        The Standard Format Specifiers from ps man page must be used for the 
        fields parameter.

        @param fields:   Fields included in the output.
                         Default: user, cmd
                         (PID or SPID column is included by default.)
        @param threads:  If True, include threads in output.
        @param **kwargs: Keyword variables are used for filtering the results
                         depending on the values of the columns. Each keyword 
                         must correspond to a field name with an optional 
                         suffix:
                         field:          Field equal to value or in list of 
                                         values.
                         field_ic:       Field equal to value or in list of 
                                         values, using case insensitive 
                                         comparison.
                         field_regex:    Field matches regex value or matches
                                         with any regex in list of values.
                         field_ic_regex: Field matches regex value or matches
                                         with any regex in list of values 
                                         using case insensitive match. 
        @return:         Nested dictionary indexed by:
                           PID for process info.
                           SPID for thread info.