def hex_to_int(hexa):
    """Convert a hexadecimal string to an int"""

    vals = {'a': 10, 'b': 11, 'c': 12, 'd': 13, 'e': 14, 'f': 15}
    num = 0
    power = 0
    for d in hexa[::-1]:
        try:
            num += int(d) * 16 ** power
        except ValueError:
            num += vals[d] * 16 ** power
        power += 1

    return num