def _equalize(lists, fillval=None):
 lists = map(list, lists)
 upper = max((len(x) for x in lists))
 for lst in lists:
  diff = (upper - len(lst))
  if diff:
   lst.extend(([fillval] * diff))
 return lists

def _equalize ( lists , fillval = None ) : lists = map ( list , lists ) upper = max ( ( len ( x ) for x in lists ) ) for lst in lists : diff = ( upper - len ( lst ) ) if diff : lst . extend ( ( [ fillval ] * diff ) ) return lists
pad all given list items in lists to be the same length .