stbt control: Use as control recorder with stbt record

A new listener type that integrates `stbt control` with `stbt record`.

Launching `stbt record` as `stbt record --control-recorder=stbt-control`
brings up `stbt control` to record keypresses using the PC keyboard.

The control URI is 'stbt-control:<keymap_file>' where <keymap_file> is
optional and defaults to ~/.config/stbt/control.conf.

stbt.py imports stbt-control to call its main loop, which generates
the bytecode cache 'stbt-controlc'; as stbt-control doesn't have '.py'
extension, it is not '.pyc' but gets the 'c' ending. This file is
cleaned up similarly to '.pyc' files.
stbt control: Wait between keypresses to avoid LIRC failure

If `stbt control` sends keypresses to the LIRC daemon more frequently
than one keypress in 0.2 seconds, LIRC refuses the connection and the
script exits with "Resource temporarily unavailable".

To make it possible to send repeated keypresses by pressing and holding a
button on the keyboard, sleep 0.2 seconds between sending two remote
control keys and flush the buffer of the received keyboard keys.
stbt record: Delete iterator to make exceptions visible

If `stbt record` is used with `--control-recorder=stbt-control`, and an
exception is raised from inside the loop of `stbt-record.record` before
`remote_input` iterator stops, the stack trace is printed before the
the iterator is being deleted. Deleting the iterator implies deleting
`term` object in `stbt-control.main_loop`, which calls the finally
block of `stbt-control.terminal` that clears the screen, therefore the
exception message is wiped out.

If `stbt record` decreases the reference counter of `remote_input` to
zero, the iterator is deleted and the terminal window is reset to its
initial state during clean-up before the exception message is printed.
stbt control: Allow mapping Escape key

In the original release of `stbt control` mapping Escape key was not
supported because of a short delay between Escape character being
received and the remote control key being sent, which makes its use
somewhat inconvenient.

Nevertheless, some users still prefer to use this key in their keymaps,
despite the mentioned inconvenience.
stbt-control: Raise custom exception if the terminal is too small

This is a follow-up to ac484dd0. That correction printed an error
message if the terminal was too small but didn't raise an exception. The
problem with that solution is that if the terminal is even too small to
print the error message then the tool quits with the unhelpful
`curses.error` exception.

Now the tool raises an exception every time the keymap doesn't fit the
terminal window, but with a helpful exception message.
stbt control: Parse command line arguments with `argparse`

`getopt` is swapped to `argparse` module in order to make the tool
consistent with other stbt tools.

As `argparse.ArgumentParser` generates the help message automatically,
the keymap file description can now be accessed with a separate command
line argument.
stbt control: Refactoring: Use curses.ascii constants

Using `curses.ascii` constants instead of `ord(...)` calls makes the code
more readable and also makes `SPECIAL_CHARS` dictionary more consistent.
Self-test for `stbt record --control-recorder=stbt-control`

The selftests now require `expect` (from the package of the same name).