def get_brief_task_listing(tasks):
  """Get a brief one-line listing of task names (truncated if necessary)."""
  count = min(len(tasks), 2)
  listing = ''
  for i in range(0, count):
    if listing:
      listing += ', '
    listing += tasks[i].name
  if len(tasks) > count:
    listing += ', ...(and %s more)' % (len(tasks) - count)
  return listing