This PyQt code sends to ESP8266 payload binary information prepended by two bytes. 1st byte is function mode and 2nd byte is payload length. This code is able to receive binary information, to add CRC at the end or request a CRC calculation from ESP8266.
To develop ESP8266 library code I have hacked common (H)SPI libraries for ESP8266. They are included in the same compressed file (spiESP.h , spiEspDirect.h and loraESP.h ). There is an example of use at loraESP.h library.