def _get_args(self, method, args):
        def quote_string(s):
            return "\"%s\"" % s.replace("\"", "\\\"")

        args_parsed = "[list "
        for arg_name in method["ARGUMENTS"]:
            try:
                if arg_name == "_session_id_" and arg_name not in args:
                    val = quote_string("") # Fake default session id. Not needed for local API
                else:
                    val = args[arg_name]
                    if val is None:
                        val = quote_string("")
                    elif type(val) in [ int, float ]:
                        val = "%s" % val
                    elif type(val) == bool:
                        val = 1 if val else 0
                    else:
                        val = quote_string("%s" % val)

                args_parsed += "%s %s " % (quote_string(arg_name), val)
            except KeyError:
                raise PMException("Missing argument \"%s\". Needs: %s" %
                                (arg_name, ", ".join(method["ARGUMENTS"])))
        return args_parsed.rstrip(" ") + "]"