Add mysql and pop3 protocal detection and parse

hi Guys
i want to add new protocal about mysql and pop3, looks the script setup-app-layer.py can help to setup the skeleton for the protocal detection and parse, but i am not very clear how to write code for the detect and parse, is there a guild for how to add a new protocal?

thanks in advance