def addr2dec(instr):
    """
    Turns a string holding either a hex or decimal address into a decimal number
    """
    addr = None

    try:
        addr = int(instr)
    except:
        pass    
    if addr: return addr

    try:
        addr = int(instr, 16);
    except:
        pass
    return addr