Moved terminal size info to a separate function

This addresses #2378. It would be nice to be able to handle possible exceptions and look for an alternative way to find terminal size, but as of now the alternative varies (pprint uses ``conf``, ``ProgressBar`` uses ``os.environ.get('COLUMNS')``, etc.) Is this correct, or should there be a uniform alternative way to find terminal size?