def dmp_to_tuple(f, u):
 if (not u):
  return tuple(f)
 v = (u - 1)
 return tuple((dmp_to_tuple(c, v) for c in f))

def dmp_to_tuple ( f , u ) : if ( not u ) : return tuple ( f ) v = ( u - 1 ) return tuple ( ( dmp_to_tuple ( c , v ) for c in f ) )
convert f into a nested tuple of tuples .