def npinterpn(*args, **kw):
method = kw.pop('<STR_LIT>', '<STR_LIT>')<EOL>if kw:<EOL><INDENT>raise ValueError("<STR_LIT>" % kw.keys())<EOL><DEDENT>nd = (len(args)-<NUM_LIT:1>)//<NUM_LIT:2><EOL>if len(args) != <NUM_LIT:2>*nd+<NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>q = args[:nd]<EOL>qi = args[nd+<NUM_LIT:1>:]<EOL>a = args[nd]<EOL>for j in range(nd):<EOL><INDENT>a = interp(q[j], a, axis=j, kind=method)(qi[j])<EOL><DEDENT>return a<EOL>
Interpolation on N-D. 

    ai = interpn(x, y, z, ..., a, xi, yi, zi, ...)
    where the arrays x, y, z, ... define a rectangular grid
    and a.shape == (len(x), len(y), len(z), ...) are the values
    interpolate at xi, yi, zi, ...