'Return our best guess the formating of the "ps" output.'

@classmethod
def _FindPsOutputFormat(cls, cmd, args):

    output_format = []
    for arg in args:
        if (',' in arg):
            output_format.extend(arg.split(','))
    if (not output_format):
        output_format = ['user', 'pid', 'ppid', 'pcpu', 'not_implemented', 'tty', 'not_implemented', 'cmd']
    for option in ['cmd', 'command', 'args']:
        if (option in output_format):
            if (output_format.count(option) > 1):
                logging.warn("Multiple    commandline    outputs    expected    in    '%s    %s'    output.    Skipping    parsing.", cmd, '    '.join(args))
                return []
            if (output_format[(-1)] != option):
                logging.warn("'ps's    output    has    the    commandline    not    as    the    last    column.    We    can't    safely    parse    output    of    '%s    %s'.Skipping    parsing.", cmd, '    '.join(args))
                return []
    return output_format
