Change import sequence

Revise import sequence in all modules to standard library modules (e.g.
sys, os, getopt, re) then third-party modules, then locally-developed
modules.