def sort_process_stats_rows(process_stats, column, top, reverse=True):
  """
  Sorts process statistics by specified column.

  Args:
    process_stats: A list of process statistics.
    column: An int representing a column number the list should be sorted by.
    top: An int representing a process count to be printed.
    reverse: A boolean to reverse or not reverse sorted list.

  Returns:
    A list of top processes sorted by specified column.
  """
  if not top:
    top = len(process_stats)

  return sorted(process_stats, key=lambda p: p[column], reverse=reverse)[:top]