def revbaseconv(packet, from_alphabet):
    """
    convert number in custom base w/ alphabet to base 10
    :param packet: string representation of custom number
    :param from_alphabet: alphabet to use for conversion
    :return:
    """
    strlen = len(packet)
    if not strlen:
        raise ValueError('packet is empty')
    num = 0
    idx = 0
    for char in packet:
        try:
            power = strlen - (idx + 1)
            num += from_alphabet.index(char) * len(from_alphabet) ** power
            idx += 1
        except ValueError as e:
            raise ValueError(
                "Invalid encoded packet.  Illegal character '%s' provided in packet."
                 % char)
    return num
