This copies the Pybricks MicroPython bluetooth implementation. As-is, it only runs in Pybricks MicroPython.
The next commits will adapt it to work with MicroPython and then Python3. We only need the Python3 end result, but this staged approach makes it easy to keep track of what will be changed.