code: def columnize(rows):
      'Generate (i,j) indexes for fixed-width columns found in rows'
  
      ## find all character columns that are not spaces
      allNonspaces = set()
      allNonspaces.add(max(len(r) for r in rows)+1)
      for r in rows:
          for i, ch in enumerate(r):
              if not ch.isspace():
                  allNonspaces.add(i)
  
      colstart = 0
      prev = 0
  
      # collapse fields
      for i in allNonspaces:
          if i > prev+1:
              yield colstart, prev+1
              colstart = i
          prev = f columnize(rows):
      'Generate (i,j) indexes for fixed-width columns found in rows'
  
      ## find all character columns that are not spaces
      allNonspaces = set()
      allNonspaces.add(max(len(r) for r in rows)+1)
      for r in rows:
          for i, ch in enumerate(r):
              if not ch.isspace():
                  allNonspaces.add(i)
  
      colstart = 0
      prev = 0
  
      # collapse fields
      for i in allNonspaces:
          if i > prev+1:
              yield colstart, prev+1
              colstart = i
          prev = i
docs: Generate (i,j) indexes for fixed-width columns found in rows