def METHOD_NAME(x,base):
    x = asarray(x)
    rem = N = len(x)
    L = 0
    while 1:
        if rem < base:
            break
        intd = rem // base
        if base*intd != rem:
            raise ValueError("Length of data must be power of base.")
        rem = intd
        L += 1
    vec = r_[[base**n for n in range(L)]]
    newx = x[NewAxis,:]*vec[:,NewAxis]
    # compute digits 
    for k in range(L-1,-1,-1):
        newx[k] = x // vec[k]
        x = x - newx[k]*vec[k]
    # reverse digits
    newx = newx[::-1,:]
    x = 0*x
    # construct new result from reversed digts
    for k in range(L):
        x += newx[k]*vec[k]
    return x