Allow generator as input to utils.print_list.

Once the table is built, the length of the prettytable's internal array
is checked rather than re-iterrating over the input.

Adds tests for utils.print_list with list and generator input.

Change-Id: I4c0bd08bf0c943de42ad90d255a2d831c2e98828
Fixes: bug #1180059
Merge "Allow generator as input to utils.print_list."