def base_n_decoder(alphabet=ALPHABET):
    """Decode a Base X encoded string into the number

    Arguments:
    - `string`: The encoded string
    - `alphabet`: The alphabet to use for encoding
    """
    base = len(alphabet)
    char_value = dict(((c, v) for v, c in enumerate(alphabet)))

    def f(string):
        num = 0
        try:
            for char in string:
                num = num * base + char_value[char]
        except __HOLE__:
            raise ValueError('Unexpected character %r' % char)
        return num
    return f
dataset/ETHPy150Open bbangert/velruse/velruse/app/baseconvert.py/base_n_decoder