def shapelist(a):
 if (type(a) is list):
  return tuple(([len(a)] + list(shapelist(a[0]))))
 else:
  return ()

def shapelist ( a ) : if ( type ( a ) is list ) : return tuple ( ( [ len ( a ) ] + list ( shapelist ( a [ 0 ] ) ) ) ) else : return ( )
get the shape of nested list .