Python device communications protocol framework