Refactor out common serial command function.
Refactor out common serial command function.

Fixes #100

kennethlimcp/particle-cli,spark/particle-cli,kennethlimcp/particle-cli,kennethlimcp/particle-cli,spark/particle-cli,spark/particle-cli,kennethlimcp/particle-cli,kennethlimcp/particle-cli,spark/particle-cli,spark/particle-cli,kennethlimcp/particle-cli,spark/particle-cli