def get_memory_usage(user=None):
total = <NUM_LIT:0><EOL>largest_process = <NUM_LIT:0><EOL>largest_process_name = None<EOL>for p in psutil.process_iter():<EOL><INDENT>p_user = p.username()<EOL>if user is None or p_user == user:<EOL><INDENT>try:<EOL><INDENT>process_memory = p.memory_info()[<NUM_LIT:0>]<EOL><DEDENT>except psutil.AccessDenied:<EOL><INDENT>continue<EOL><DEDENT>total += process_memory<EOL>if process_memory > largest_process:<EOL><INDENT>largest_process = process_memory<EOL>largest_process_name = p.name()<EOL><DEDENT><DEDENT><DEDENT>return total, largest_process, largest_process_name<EOL>
Returns a three-tupel with memory usage for the given user.

The result contains::

    (total memory, largest process' memory, largest process name)

:param user: String representing the user. If `None`, the total size of
  all processes for all users will be returned.