code: def rows(thelist, n):
      
      try:
          n = int(n)
          thelist = list(thelist)
      except (ValueError, TypeError):
          return [thelist]
      list_len = len(thelist)
      split = list_len // n
  
      if list_len % n != 0:
          split += 1
      return [thelist[split * i:split * (i + 1)] for i in range(n)]
docs: Break a list into ``n`` rows, filling up each row to the maximum equal
      length possible. For example::
  
          >>> l = range(10)
  
          >>> rows(l, 2)
          [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
  
          >>> rows(l, 3)
          [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9]]
  
          >>> rows(l, 4)
          [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
  
          >>> rows(l, 5)
          [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]
  
          >>> rows(l, 9)
          [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [], [], [], []]
  
          # This filter will always return `n` rows, even if some are empty:
          >>> rows(range(2), 3)
          [[0], [1], []]