def __b85_decode(data, lut, byte_order, special_values=None):
    """Decodes the given string data by using the given LUT and byte order

    :param str data: A string which contains the encoded data
    :param dict lut: A dict where the keys are encoded characters and the
      values are the integer correspondence of those characters and will be
      used to generate an integer number.
    :param str byte_order: The byte order character for struct.pack
    :param bool unpack_z: replaces character "z" with appropriate characters
      for the "0 special case" (where it is not converted to a 5 character
      string but "z")
    """
    if special_values:
        for key in special_values.keys():
            # if the data is massive, then we are using twice the memory
            # use key.join(data.split(special_values[key]))
            data = data.replace(special_values[key], key)
            #data = key.join(data.split(special_values[key]))

    parts = []
    parts_append = parts.append
    pack = struct.pack
    byte_format = '%sI' % byte_order
    for i in xrange(0, len(data), 5):
        int_sum = 52200625 * lut[data[i]] + \
            614125 * lut[data[i + 1]] + \
            7225 * lut[data[i + 2]] + \
            85 * lut[data[i + 3]] + \
            lut[data[i + 4]]
        parts_append(pack(byte_format, int_sum))
    return ''.join(parts)
dataset/ETHPy150Open eoyilmaz/anima/anima/render/arnold/base85.py/__b85_decode/original