'Convert a C{kCFSocket...} constant to an index into the read/write
state list (C{_READ} or C{_WRITE}) (the 4th element of the value of
C{self._fdmap}).
@param flag: C{kCFSocketReadCallBack} or C{kCFSocketWriteCallBack}
@return: C{_READ} or C{_WRITE}'

def _flag2idx(self, flag):

    return {kCFSocketReadCallBack: _READ, kCFSocketWriteCallBack: _WRITE}[flag]
