def merge_opt_params(self, method, kargs):
for key in self.legal_params[method]:<EOL><INDENT>if not hasattr(self.opt, key) or getattr(self.opt, key) is None:<EOL><INDENT>continue<EOL><DEDENT>if key in kargs and type(kargs[key]) == dict:<EOL><INDENT>assert(type(getattr(self.opt, key)) == dict)<EOL>for k, v in getattr(self.opt, key).iteritems():<EOL><INDENT>kargs[key][k] = v<EOL><DEDENT><DEDENT>else:<EOL><INDENT>kargs[key] = getattr(self.opt, key)<EOL><DEDENT><DEDENT>return kargs<EOL>
Combine existing parameters with extra options supplied from command line
           options. Carefully merge special type of parameter if needed.