def _pressModifiers(self, modifiers, pressed=True, globally=False):
if not isinstance(modifiers, list):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self.keyboard = AXKeyboard.loadKeyboard()<EOL><DEDENT>modFlags = <NUM_LIT:0><EOL>for nextMod in modifiers:<EOL><INDENT>if nextMod not in self.keyboard:<EOL><INDENT>errStr = '<STR_LIT>'<EOL>self._clearEventQueue()<EOL>raise ValueError(errStr % self.keyboard[nextMod])<EOL><DEDENT>modEvent = Quartz.CGEventCreateKeyboardEvent(<EOL>Quartz.CGEventSourceCreate(<NUM_LIT:0>),<EOL>self.keyboard[nextMod],<EOL>pressed<EOL>)<EOL>if not pressed:<EOL><INDENT>Quartz.CGEventSetFlags(modEvent, <NUM_LIT:0>)<EOL><DEDENT>if globally:<EOL><INDENT>self._queueEvent(Quartz.CGEventPost, (<NUM_LIT:0>, modEvent))<EOL><DEDENT>else:<EOL><INDENT>macVer, _, _ = platform.mac_ver()<EOL>macVer = int(macVer.split('<STR_LIT:.>')[<NUM_LIT:1>])<EOL>if macVer > <NUM_LIT:10>:<EOL><INDENT>appPid = self._getPid()<EOL>self._queueEvent(Quartz.CGEventPostToPid, (appPid, modEvent))<EOL><DEDENT>else:<EOL><INDENT>appPsn = self._getPsnForPid(self._getPid())<EOL>self._queueEvent(Quartz.CGEventPostToPSN, (appPsn, modEvent))<EOL><DEDENT><DEDENT>modFlags += AXKeyboard.modKeyFlagConstants[nextMod]<EOL><DEDENT>return modFlags<EOL>
Press given modifiers (provided in list form).

        Parameters: modifiers list, global or app specific
        Optional: keypressed state (default is True (down))
        Returns: Unsigned int representing flags to set