'Set/clear/toggle value of a flag register
Returns:
- True if success (Bool)'

def set_eflags(self, flagname, value):

    EFLAGS_CF = (1 << 0)
    EFLAGS_PF = (1 << 2)
    EFLAGS_AF = (1 << 4)
    EFLAGS_ZF = (1 << 6)
    EFLAGS_SF = (1 << 7)
    EFLAGS_TF = (1 << 8)
    EFLAGS_IF = (1 << 9)
    EFLAGS_DF = (1 << 10)
    EFLAGS_OF = (1 << 11)
    flags = {'carry': 'CF', 'parity': 'PF', 'adjust': 'AF', 'zero': 'ZF', 'sign': 'SF', 'trap': 'TF', 'interrupt': 'IF', 'direction': 'DF', 'overflow': 'OF'}
    flagname = flagname.lower()
    if (flagname not in flags):
        return False
    eflags = self.get_eflags()
    if (not eflags):
        return False
    if ((value is None) or (eflags[flags[flagname]] != value)):
        reg_eflags = self.getreg('eflags')
        reg_eflags ^= eval(('EFLAGS_%s' % flags[flagname]))
        result = self.execute(('set    $eflags    =    0x%x' % reg_eflags))
        return result
    return True
