code: def shorten_url(url, cols, shorten):
      
      cols = ((cols - 6) * .85)  # 6 cols for urlref and don't use while line
      if shorten is False or len(url) < cols:
          return url
      split = int(cols * .5)
      return url[:split] + "..." + url[-split:]
docs: Shorten long URLs to fit on one line.