def get_cpu_usage(user=None, ignore_self=True):
pid = os.getpid()<EOL>cmd = "<STR_LIT>"<EOL>output = getoutput(cmd)<EOL>total = <NUM_LIT:0><EOL>largest_process = <NUM_LIT:0><EOL>largest_process_name = None<EOL>for row in output.split('<STR_LIT:\n>')[<NUM_LIT:1>:]:<EOL><INDENT>row = row.split()<EOL>if row[<NUM_LIT:1>] == str(pid) and ignore_self:<EOL><INDENT>continue<EOL><DEDENT>if user is None or user == row[<NUM_LIT:0>]:<EOL><INDENT>cpu = decimal.Decimal(row[<NUM_LIT:2>])<EOL>if cpu > total:<EOL><INDENT>largest_process = cpu<EOL>largest_process_name = '<STR_LIT:U+0020>'.join(row[<NUM_LIT:10>:len(row)])<EOL><DEDENT>total += decimal.Decimal(row[<NUM_LIT:2>])<EOL><DEDENT><DEDENT>return total, largest_process, largest_process_name<EOL>
Returns the total CPU usage for all available cores.

:param user: If given, returns only the total CPU usage of all processes
  for the given user.
:param ignore_self: If ``True`` the process that runs this script will
  be ignored.