def METHOD_NAME(asu, n, mn, mx, asu2=None):
  assert (asu2 is None) or isinstance(asu, new_asu.direct_space_asu)
  first_is_new = False
  step, vv = step_v(n, mn, mx)
  grid = ()
  for s in step:
    g = rint(1) / s
    g = g.numerator()//g.denominator() + 1
    assert g > 0, "Step = "+str(step)
    grid += tuple([g])
  mna = list(mn)
  mxa = list(mx)
  for i in range(3):
    mna[i] -= 5*step[i]
    mna[i] *= grid[i]
    mna[i] = mna[i].numerator()//mna[i].denominator()-1
    mxa[i] += 5*step[i]
    mxa[i] *= grid[i]
    mxa[i] = mxa[i].numerator()//mxa[i].denominator()+1
  print("grid test  step= ", step, "  min= ", mna, "  max= ", mxa, \
      "   grid=", grid, file=cout)
  if isinstance(asu, new_asu.direct_space_asu):
    import copy
    # TODO: implement
    # asu_opt = copy.copy(asu)
    # asu_opt.optimize_for_grid(grid)
    # assert asu_opt.is_optimized() and (not asu.is_optimized())
    first_is_new = True
    # max_p = asu_opt.get_optimized_grid_limits()
    # print >>cout, "grid limits: ", max_p
  result = 0
  i = mna[0]
  while i <= mxa[0] :
    ii = rint(i,grid[0])
    j = mna[1]
    while j <= mxa[1] :
      jj = rint(j,grid[1])
      k = mna[2]
      while k <= mxa[2] :
        kk = rint(k,grid[2])
        b = asu.is_inside((ii,jj,kk)) # rational test
        if b :
          result += 1
        if first_is_new:
          num = (i, j, k)
          den = grid
          where = asu.where_is(num,den) # integer test
          #TODO: implement? assert b == asu.is_inside(num,den)
          assert ( b and (where==1 or where==-1)) or ( (not b) and where==0 )
          #TODO: implemnt where_opt = asu_opt.where_is( num ) # optimized test
          #  assert where_opt == where
          #TODO: implement? assert b == asu_opt.is_inside(num)
        if asu2 is not None :
          assert b == asu2.is_inside( (ii,jj,kk) ) # rational test
        k += 1
      j += 1
    i += 1
  shape = result / vv
  return (result,shape)