def TransposeTable(table):
  """Transpose a list of lists, using None to extend all input lists to the
  same length.

  For example:
  >>> TransposeTable(
  [ [11,   12,   13],
    [21,   22],
    [31,   32,   33,   34]])

  [ [11,   21,   31],
    [12,   22,   32],
    [13,   None, 33],
    [None, None, 34]]
  """
  transposed = []
  rows = len(table)
  cols = max(len(row) for row in table)
  for x in range(cols):
    transposed.append([])
    for y in range(rows):
      if x < len(table[y]):
        transposed[x].append(table[y][x])
      else:
        transposed[x].append(None)
  return transposed
def TransposeTable ( table ) : transposed = [ ] rows = len ( table ) cols = max ( len ( row ) for row in table ) for x in range ( cols ) : transposed . append ( [ ] ) for y in range ( rows ) : if x < len ( table [ y ] ) : transposed [ x ] . append ( table [ y ] [ x ] ) else : transposed [ x ] . append ( None ) return transposed
Transpose a list of lists, using None to extend all input lists to the
  same length.

  For example:
  >>> TransposeTable(
  [ [11,   12,   13],
    [21,   22],
    [31,   32,   33,   34]])

  [ [11,   21,   31],
    [12,   22,   32],
    [13,   None, 33],
    [None, None, 34]]