'Simulates a keypress on the focused window.
Parameters
modifiers :
A list of modifier specification strings. Modifiers can be one of
"shift", "lock", "control" and "mod1" - "mod5".
key :
Key specification.
Examples
simulate_keypress(["control", "mod2"], "k")'

def cmd_simulate_keypress(self, modifiers, key):

    keysym = xcbq.keysyms.get(key)
    if (keysym is None):
        raise command.CommandError(u'Unknown    key:    {0:s}'.format(key))
    keycode = self.conn.first_sym_to_code[keysym]
    class DummyEv(object, ):
        pass
    d = DummyEv()
    d.detail = keycode
    try:
        d.state = utils.translate_masks(modifiers)
    except KeyError as v:
        return v.args[0]
    self.handle_KeyPress(d)
