def _recursive_flatten(cell, dtype):
 while (not isinstance(cell[0], dtype)):
  cell = [c for d in cell for c in d]
 return cell

def _recursive_flatten ( cell , dtype ) : while ( not isinstance ( cell [ 0 ] , dtype ) ) : cell = [ c for d in cell for c in d ] return cell
helper to unpack mat files in python .