def modifiers_dict(modifiers):
 return {mod[4:].lower(): ((modifiers & getattr(sys.modules[__name__], mod)) > 0) for mod in ['MOD_SHIFT', 'MOD_CTRL', 'MOD_ALT', 'MOD_CAPSLOCK', 'MOD_NUMLOCK', 'MOD_WINDOWS', 'MOD_COMMAND', 'MOD_OPTION', 'MOD_SCROLLLOCK']}

def modifiers_dict ( modifiers ) : return { mod [ 4 : ] . lower ( ) : ( ( modifiers & getattr ( sys . modules [ __name__ ] , mod ) ) > 0 ) for mod in [ 'MOD_SHIFT' , 'MOD_CTRL' , 'MOD_ALT' , 'MOD_CAPSLOCK' , 'MOD_NUMLOCK' , 'MOD_WINDOWS' , 'MOD_COMMAND' , 'MOD_OPTION' , 'MOD_SCROLLLOCK' ] }
return dict where the key is a keyboard modifier flag and the value is the boolean state of that flag .