Refactor: Make StateHandler() function independent.
Refactor: Make StateHandler() function independent.

This refactor makes the nested class 'StateHandler' in the
file /contrib_bots/bot_lib.py independent class. It previously
was nested in 'run_message_handler_for_bot' function.

This is done to write a cleaner test file for contrib_bots using
mock library.

christi3k/zulip,amanharitsh123/zulip,zulip/zulip,dhcrzf/zulip,brockwhittaker/zulip,vabs22/zulip,showell/zulip,showell/zulip,zulip/zulip,eeshangarg/zulip,dhcrzf/zulip,rht/zulip,eeshangarg/zulip,vabs22/zulip,rishig/zulip,showell/zulip,brockwhittaker/zulip,tommyip/zulip,jackrzhang/zulip,shubhamdhama/zulip,brainwane/zulip,eeshangarg/zulip,hackerkid/zulip,rishig/zulip,vaidap/zulip,jrowan/zulip,dhcrzf/zulip,shubhamdhama/zulip,hackerkid/zulip,shubhamdhama/zulip,jackrzhang/zulip,verma-varsha/zulip,brainwane/zulip,kou/zulip,jrowan/zulip,jrowan/zulip,verma-varsha/zulip,shubhamdhama/zulip,andersk/zulip,eeshangarg/zulip,rht/zulip,amanharitsh123/zulip,andersk/zulip,kou/zulip,brainwane/zulip,vabs22/zulip,jrowan/zulip,hackerkid/zulip,jackrzhang/zulip,kou/zulip,rishig/zulip,brockwhittaker/zulip,amanharitsh123/zulip,hackerkid/zulip,Galexrt/zulip,zulip/zulip,showell/zulip,rishig/zulip,Galexrt/zulip,brainwane/zulip,timabbott/zulip,brainwane/zulip,Galexrt/zulip,rht/zulip,mahim97/zulip,zulip/zulip,punchagan/zulip,j831/zulip,zulip/zulip,zulip/zulip,j831/zulip,shubhamdhama/zulip,hackerkid/zulip,andersk/zulip,vaidap/zulip,vaidap/zulip,brockwhittaker/zulip,vaidap/zulip,christi3k/zulip,timabbott/zulip,mahim97/zulip,timabbott/zulip,synicalsyntax/zulip,tommyip/zulip,timabbott/zulip,punchagan/zulip,Galexrt/zulip,amanharitsh123/zulip,brainwane/zulip,verma-varsha/zulip,rishig/zulip,andersk/zulip,eeshangarg/zulip,j831/zulip,christi3k/zulip,jrowan/zulip,zulip/zulip,hackerkid/zulip,punchagan/zulip,dhcrzf/zulip,timabbott/zulip,rht/zulip,vabs22/zulip,kou/zulip,tommyip/zulip,christi3k/zulip,timabbott/zulip,rht/zulip,andersk/zulip,christi3k/zulip,kou/zulip,shubhamdhama/zulip,punchagan/zulip,rishig/zulip,j831/zulip,brockwhittaker/zulip,tommyip/zulip,synicalsyntax/zulip,mahim97/zulip,synicalsyntax/zulip,mahim97/zulip,jackrzhang/zulip,synicalsyntax/zulip,jrowan/zulip,amanharitsh123/zulip,hackerkid/zulip,eeshangarg/zulip,andersk/zulip,jackrzhang/zulip,christi3k/zulip,mahim97/zulip,tommyip/zulip,synicalsyntax/zulip,vaidap/zulip,showell/zulip,Galexrt/zulip,showell/zulip,dhcrzf/zulip,kou/zulip,synicalsyntax/zulip,dhcrzf/zulip,verma-varsha/zulip,andersk/zulip,tommyip/zulip,brainwane/zulip,punchagan/zulip,mahim97/zulip,shubhamdhama/zulip,j831/zulip,vabs22/zulip,punchagan/zulip,kou/zulip,rishig/zulip,timabbott/zulip,jackrzhang/zulip,punchagan/zulip,verma-varsha/zulip,j831/zulip,amanharitsh123/zulip,eeshangarg/zulip,verma-varsha/zulip,showell/zulip,tommyip/zulip,rht/zulip,Galexrt/zulip,jackrzhang/zulip,vabs22/zulip,dhcrzf/zulip,rht/zulip,synicalsyntax/zulip,Galexrt/zulip,vaidap/zulip,brockwhittaker/zulip