var $wnd = window;
var $doc = window.document;
var $pyjs = new Object();
$pyjs.global_namespace = this;
$pyjs.__modules__ = {};
$pyjs.modules_hash = {};
$pyjs.available_modules = ['sys', 'pyjslib', 'JSONParser', 'webclientController', 'math', 'sets', 'commonFunc'];
$pyjs.loaded_modules = {};
$pyjs.options = new Object();
$pyjs.options.set_all = function (v) {
    $pyjs.options.arg_ignore = v;
    $pyjs.options.arg_count = v;
    $pyjs.options.arg_is_instance = v;
    $pyjs.options.arg_instance_type = v;
    $pyjs.options.arg_kwarg_dup = v;
    $pyjs.options.arg_kwarg_unexpected_keyword = v;
    $pyjs.options.arg_kwarg_multiple_values = v;
};
$pyjs.options.set_all(true);
$pyjs.trackstack = [];
$pyjs.track = {module:'__main__', lineno: 1};
$pyjs.trackstack.push($pyjs.track);
$pyjs.__last_exception_stack__ = null;
$pyjs.__last_exception__ = null;


function pyjs_kwargs_call(obj, func, star_args, dstar_args, args)
{
    if (obj !== null) {
        func = obj[func];
    }

    // Merge dstar_args into args[0]
    if (dstar_args) {
        if (pyjslib.get_pyjs_classtype(dstar_args) != 'Dict') {
            throw (pyjslib.TypeError(func.__name__ + "() arguments after ** must be a dictionary " + pyjslib.repr(dstar_args)));
        }
        var __i = dstar_args.__iter__();
        try {
            while (true) {
                var i = __i.next();
                if ($pyjs.options.arg_kwarg_multiple_values && typeof args[0][i] != 'undefined') {
                    pyjs__exception_func_multiple_values(func.__name__, i);
                }
                args[0][i] = dstar_args.__getitem__(i);
            }
        } catch (e) {
            if (e != pyjslib.StopIteration) {
                throw e;
            }
        }

    }

    // Append star_args to args
    if (star_args) {
        if (!pyjslib.isIteratable(star_args)) {
            throw (pyjslib.TypeError(func.__name__ + "() arguments after * must be a sequence" + pyjslib.repr(star_args)));
        }
        if (star_args.l != null && star_args.l.constructor == Array) {
            args = args.concat(star_args.l);
        } else {
            var call_args = Array();
            var __i = star_args.__iter__();
            var i = 0;
            try {
                while (true) {
                    call_args[i]=__i.next();
                    i++;
                }
            } catch (e) {
                if (e != pyjslib.StopIteration) {
                    throw e;
                }
            }
            args = args.concat(call_args);
        }
    }

    // Now convert args to call_args
    // args = __kwargs, arg1, arg2, ...
    // _args = arg1, arg2, arg3, ... [*args, [**kwargs]]
    var _args = [];

    // Get function/method arguments
    if (typeof func.__args__ != 'undefined') {
        var __args__ = func.__args__;
    } else {
        var __args__ = new Array(null, null);
    }

    var a, aname, _idx , idx;
    _idx = idx = 1;
    if (obj === null) {
        if (func.__is_instance__ === false) {
            // Skip first argument in __args__
            _idx ++;
        }
    } else {
        if (typeof obj.__is_instance__ == 'undefined' && typeof func.__is_instance__ != 'undefined' && func.__is_instance__ === false) {
            // Skip first argument in __args__
            _idx ++;
        } else if (func.__bind_type__ > 0) {
            if (typeof args[1] == 'undefined' || obj.__is_instance__ !== false || args[1].__is_instance__ !== true) {
                // Skip first argument in __args__
                _idx ++;
            }
        }
    }
    for (++_idx; _idx < __args__.length; _idx++, idx++) {
        aname = __args__[_idx];
        a = args[0][aname];
        if (typeof args[idx] == 'undefined') {
            _args.push(a);
            delete args[0][aname];
        } else {
            if (typeof a != 'undefined') pyjs__exception_func_multiple_values(func.__name__, aname);
            _args.push(args[idx]);
        }
    }

    // Append the left-over args
    for (;idx < args.length;idx++) {
            _args.push(args[idx]);
    }

    if (__args__[1] === null) {
        // Check for unexpected keyword
        for (var kwname in args[0]) {
            pyjs__exception_func_unexpected_keyword(func.__name__, kwname);
        }
    } else {
        _args.push(pyjslib.Dict(args[0]));
    }
    return func.apply(obj, _args);
}

function pyjs__exception_func_param(func_name, minargs, maxargs, nargs) {
    if (minargs == maxargs) {
        switch (minargs) {
            case 0:
                var msg = func_name + "() takes no arguments (" + nargs + " given)";
                break;
            case 1:
                msg = func_name + "() takes exactly " + minargs + " argument (" + nargs + " given)";
                break;
            default:
                msg = func_name + "() takes exactly " + minargs + " arguments (" + nargs + " given)";
        }
    } else if (nargs > maxargs) {
        if (maxargs == 1) {
            msg  = func_name + "() takes at most " + maxargs + " argument (" + nargs + " given)";
        } else {
            msg = func_name + "() takes at most " + maxargs + " arguments (" + nargs + " given)";
        }
    } else if (nargs < minargs) {
        if (minargs == 1) {
            msg = func_name + "() takes at least " + minargs + " argument (" + nargs + " given)";
        } else {
            msg = func_name + "() takes at least " + minargs + " arguments (" + nargs + " given)";
        }
    } else {
        return;
    }
    if (typeof pyjslib.TypeError == 'function') {
        throw pyjslib.TypeError(String(msg));
    }
    throw msg;
}

function pyjs__exception_func_multiple_values(func_name, key) {
    //throw func_name + "() got multiple values for keyword argument '" + key + "'";
    throw pyjslib.TypeError(String(func_name + "() got multiple values for keyword argument '" + key + "'"));
}

function pyjs__exception_func_unexpected_keyword(func_name, key) {
    //throw func_name + "() got an unexpected keyword argument '" + key + "'";
    throw pyjslib.TypeError(String(func_name + "() got an unexpected keyword argument '" + key + "'"));
}

function pyjs__exception_func_class_expected(func_name, class_name, instance) {
        if (typeof instance == 'undefined') {
            instance = 'nothing';
        } else if (instance.__is_instance__ == null) {
            instance = "'"+String(instance)+"'";
        } else {
            instance = String(instance);
        }
        //throw "unbound method "+func_name+"() must be called with "+class_name+" class as first argument (got "+instance+" instead)";
        throw pyjslib.TypeError(String("unbound method "+func_name+"() must be called with "+class_name+" class as first argument (got "+instance+" instead)"));
}

function pyjs__exception_func_instance_expected(func_name, class_name, instance) {
        if (typeof instance == 'undefined') {
            instance = 'nothing';
        } else if (instance.__is_instance__ == null) {
            instance = "'"+String(instance)+"'";
        } else {
            instance = String(instance);
        }
        //throw "unbound method "+func_name+"() must be called with "+class_name+" instance as first argument (got "+instance+" instead)";
        throw pyjslib.TypeError(String("unbound method "+func_name+"() must be called with "+class_name+" instance as first argument (got "+instance+" instead)"));
}

function pyjs__bind_method(klass, func_name, func, bind_type, args) {
    func.__name__ = func.func_name = func_name;
    func.__bind_type__ = bind_type;
    func.__args__ = args;
    func.__class__ = klass;
    func.prototype = func;
    return func;
}

function pyjs__decorate_method(klass, func_name, func, bind_type) {
    func.__name__ = func.func_name = func_name;
    func.__bind_type__ = bind_type;
    func.__class__ = klass;
    func.prototype = func;
    return func;
}

function pyjs__instancemethod(klass, func_name, func, bind_type, args) {
    var fn = function () {
        var _this = this;
        var argstart = 0;
        if (this.__is_instance__ !== true && arguments.length > 0) {
            _this = arguments[0];
            argstart = 1;
        }
        var args = new Array(_this);
        for (var a=argstart;a < arguments.length; a++) args.push(arguments[a]);
        if ($pyjs.options.arg_is_instance) {
            if (_this.__is_instance__ === true) {
                if ($pyjs.options.arg_instance_type) return func.apply(this, args);
                for (var c in _this.__mro__) {
                    var cls = _this.__mro__[c];
                    if (cls == klass) {
                        return func.apply(this, args);
                    }
                }
            }
            pyjs__exception_func_instance_expected(func_name, klass.__name__, _this);
        }
        return func.apply(this, args);
    };
    func.__name__ = func.func_name = func_name;
    func.__bind_type__ = bind_type;
    func.__args__ = args;
    func.__class__ = klass;
    return fn;
}

function pyjs__mro_merge(seqs) {
    var res = new Array();
    var i = 0;
    var cand = null;
    function resolve_error(candidates) {
        //throw "Cannot create a consistent method resolution order (MRO) for bases " + candidates[0].__name__ + ", "+ candidates[1].__name__;
        throw (pyjslib.TypeError("Cannot create a consistent method resolution order (MRO) for bases " + candidates[0].__name__ + ", "+ candidates[1].__name__));
    }
    for (;;) {
        var nonemptyseqs = new Array();
        for (var j = 0; j < seqs.length; j++) {
            if (seqs[j].length > 0) nonemptyseqs.push(seqs[j]);
        }
        if (nonemptyseqs.length == 0) return res;
        i++;
        var candidates = new Array();
        for (var j = 0; j < nonemptyseqs.length; j++) {
            cand = nonemptyseqs[j][0];
            candidates.push(cand);
            var nothead = new Array();
            for (var k = 0; k < nonemptyseqs.length; k++) {
                for (var m = 1; m < nonemptyseqs[k].length; m++) {
                    if (cand == nonemptyseqs[k][m]) {
                        nothead.push(nonemptyseqs[k]);
                    }
                }
            }
            if (nothead.length != 0)
                cand = null; // reject candidate
            else
                break;
        }
        if (cand == null) {
            resolve_error(candidates);
        }
        res.push(cand);
        for (var j = 0; j < nonemptyseqs.length; j++) {
            if (nonemptyseqs[j][0] == cand) {
                nonemptyseqs[j].shift();
            }
        }
    }
}

function pyjs__class_instance(class_name, module_name) {
    if (typeof module_name == 'undefined') module_name = typeof __mod_name__ == 'undefined' ? '__main__' : __mod_name__;
    var cls_fn = function(){
        var instance = cls_fn.__new__.apply(null, [cls_fn]);
        if (instance.__init__) {
            if (instance.__init__.apply(instance, arguments) != null) {
                //throw '__init__() should return None';
                throw pyjslib.TypeError('__init__() should return None');
            }
        }
        return instance;
    };
    cls_fn.__name__ = class_name;
    cls_fn.__module__ = module_name;
    cls_fn.__str__ = function() { return (this.__is_instance__ === true ? "instance of " : "class ") + (this.__module__?this.__module__ + "." : "") + this.__name__;};
    cls_fn.toString = function() { return this.__str__();};
    return cls_fn;
}

function pyjs__class_function(cls_fn, prop, bases) {
    if (typeof cls_fn != 'function') throw "compiler error? pyjs__class_function: typeof cls_fn != 'function'";
    var class_name = cls_fn.__name__;
    var class_module = cls_fn.__module__;
    var base_mro_list = new Array();
    for (var i = 0; i < bases.length; i++) {
        if (bases[i].__mro__ != null) {
            base_mro_list.push(new Array().concat(bases[i].__mro__));
        }
    }
    var __mro__ = pyjs__mro_merge(base_mro_list);

    for (var b = __mro__.length-1; b >= 0; b--) {
        var base = __mro__[b];
        for (var p in base) cls_fn[p] = base[p];
    }
    for (var p in prop) cls_fn[p] = prop[p];

    if (prop.__new__ == null) {
        cls_fn.__new__ = pyjs__bind_method(cls_fn, '__new__', function(cls) {
    var instance = function () {};
    instance.prototype = arguments[0].prototype;
    instance = new instance();
    instance.__dict__ = instance.__class__ = instance;
    instance.__is_instance__ = true;
    return instance;
}, 1, ['cls']);
    }
    if (cls_fn['__init__'] == null) {
        cls_fn['__init__'] = pyjs__bind_method(cls_fn, '__init__', function () {
    if (this.__is_instance__ === true) {
        var self = this;
        if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
    } else {
        var self = arguments[0];
        if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
        if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
    }
    if ($pyjs.options.arg_instance_type) {
        if (arguments.callee !== arguments.callee.__class__[arguments.callee.__name__]) {
            if (!pyjslib._isinstance(self, arguments.callee.__class__.slice(1))) {
                pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
            }
        }
    }
}, 0, ['self']);
    }
    cls_fn.__name__ = class_name;
    cls_fn.__module__ = class_module;
    //cls_fn.__mro__ = pyjslib.List(new Array(cls_fn).concat(__mro__));
    cls_fn.__mro__ = new Array(cls_fn).concat(__mro__);
    cls_fn.prototype = cls_fn;
    cls_fn.__dict__ = cls_fn;
    cls_fn.__is_instance__ = false;
    cls_fn.__super_classes__ = bases;
    cls_fn.__sub_classes__ = new Array();
    for (var i = 0; i < bases.length; i++) {
        (bases[i]).__sub_classes__.push(cls_fn);
    }
    cls_fn.__args__ = cls_fn.__init__.__args__;
    return cls_fn;
}

/* creates a class, derived from bases, with methods and variables */
function pyjs_type(clsname, bases, methods)
{
    var cls_instance = pyjs__class_instance(clsname);
    var obj = new Object;
    for (var i in methods) {
        if (typeof methods[i] == 'function') {
            obj[i] = pyjs__instancemethod(cls_instance, i, methods[i], methods[i].__bind_type__, methods[i].__args__);
        } else {
            obj[i] = methods[i];
        }
    }
    return pyjs__class_function(cls_instance, obj, bases);
}

function pyjs_op_add(left, right)
{
  if ((typeof left == "string") || (typeof left == "number"))
    return left + right;
  else
    return left.__add__(right);
}



/* start module: sys */
var sys = $pyjs.loaded_modules["sys"] = function (__mod_name__) {
if(sys.__was_initialized__) return sys;
sys.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'sys';
var __name__ = sys.__name__ = __mod_name__;
sys.overrides = null;
sys.loadpath = null;
sys.stacktrace = null;
sys.appname = null;
sys.setloadpath = function(lp) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

	sys.loadpath = lp;
	return null;
};
sys.setloadpath.__name__ = 'setloadpath';

sys.setloadpath.__bind_type__ = 0;
sys.setloadpath.__args__ = [null,null,'lp'];
sys.setappname = function(an) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

	sys.appname = an;
	return null;
};
sys.setappname.__name__ = 'setappname';

sys.setappname.__bind_type__ = 0;
sys.setappname.__args__ = [null,null,'an'];
sys.getloadpath = function() {
	if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);

	return sys.loadpath;
};
sys.getloadpath.__name__ = 'getloadpath';

sys.getloadpath.__bind_type__ = 0;
sys.getloadpath.__args__ = [null,null];
sys.addoverride = function(module_name, path) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

	sys.overrides.__setitem__(module_name, path);
	return null;
};
sys.addoverride.__name__ = 'addoverride';

sys.addoverride.__bind_type__ = 0;
sys.addoverride.__args__ = [null,null,'module_name', 'path'];
sys.exc_info = function() {
	if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);
	var le,cls;
	le = $pyjs.__last_exception__;
	if (pyjslib.bool(!(le))) {
		return new pyjslib.Tuple([null, null, null]);
	}
	if (pyjslib.bool(!(pyjslib.hasattr((le.error===undefined?(function(){throw new TypeError('le.error is undefined');})():(typeof le.error == 'function' && le.__is_instance__?pyjslib.getattr(le, 'error'):le.error)), String('__class__'))))) {
		cls = null;
	}
	else {
		cls = (le.error.__class__===undefined?(function(){throw new TypeError('le.error.__class__ is undefined');})():(typeof le.error.__class__ == 'function' && le.error.__is_instance__?pyjslib.getattr(le.error, '__class__'):le.error.__class__));
	}
	return new pyjslib.Tuple([cls, (le.error===undefined?(function(){throw new TypeError('le.error is undefined');})():(typeof le.error == 'function' && le.__is_instance__?pyjslib.getattr(le, 'error'):le.error)), null]);
};
sys.exc_info.__name__ = 'exc_info';

sys.exc_info.__bind_type__ = 0;
sys.exc_info.__args__ = [null,null];
sys.exc_clear = function() {
	if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);

$pyjs.__last_exception__ = null;
};
sys.exc_clear.__name__ = 'exc_clear';

sys.exc_clear.__bind_type__ = 0;
sys.exc_clear.__args__ = [null,null];
sys.save_exception_stack = function () {
    var save_stack = [];
    for (var needle in $pyjs.trackstack) {
        var t = new Object();
        for (var p in $pyjs.trackstack[needle]) {
            t[p] = $pyjs.trackstack[needle][p];
        }
        save_stack.push(t);
        $pyjs.__last_exception_stack__ = save_stack;
    }
return null;
};
sys.trackstackstr = function(stack) {
	if ($pyjs.options.arg_count && (arguments.length < 0 || arguments.length > 1)) pyjs__exception_func_param(arguments.callee.__name__, 0, 1, arguments.length);
	if (typeof stack == 'undefined') stack=null;
	var msg,s,stackstrings;
	if (pyjslib.bool((stack === null))) {
		stack = $pyjs.__last_exception_stack__;
	}
	if (pyjslib.bool(!(stack))) {
		return String('');
	}
	stackstrings = new pyjslib.List([]);
	msg = String('');
	var __s = pyjslib.list(stack).__iter__();
	try {
		while (true) {
			var s = __s.next();
			
msg = eval(s.module + '.__track_lines__[' + s.lineno + ']');
			if (pyjslib.bool(msg)) {
				stackstrings.append(msg);
			}
			else {
				stackstrings.append(pyjslib.sprintf(String('%s.py, line %d'), new pyjslib.Tuple([(s.module===undefined?(function(){throw new TypeError('s.module is undefined');})():(typeof s.module == 'function' && s.__is_instance__?pyjslib.getattr(s, 'module'):s.module)), (s.lineno===undefined?(function(){throw new TypeError('s.lineno is undefined');})():(typeof s.lineno == 'function' && s.__is_instance__?pyjslib.getattr(s, 'lineno'):s.lineno))])));
			}
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	return String('\x0A').join(stackstrings);
};
sys.trackstackstr.__name__ = 'trackstackstr';

sys.trackstackstr.__bind_type__ = 0;
sys.trackstackstr.__args__ = [null,null,'stack'];
sys.platform = $pyjs.platform;
sys.byteorder = String('little');
return this;
}; /* end sys */
$pyjs.modules_hash['sys'] = $pyjs.loaded_modules['sys'];


 /* end module: sys */




/* start module: pyjslib */
var pyjslib = $pyjs.loaded_modules["pyjslib"] = function (__mod_name__) {
if(pyjslib.__was_initialized__) return pyjslib;
pyjslib.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'pyjslib';
var __name__ = pyjslib.__name__ = __mod_name__;
pyjslib.object = (function(){
	var cls_instance = pyjs__class_instance('object');
	var cls_definition = new Object();
	cls_definition.__md5__ = 'd3dba22d06267294aa8ed4fd1efaad06';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array());
})();
pyjslib.__import__ = function(searchList, path, context, module_name) {
	if ($pyjs.options.arg_count && (arguments.length < 3 || arguments.length > 4)) pyjs__exception_func_param(arguments.callee.__name__, 3, 4, arguments.length);
	if (typeof module_name == 'undefined') module_name=null;
	var available,importName,err,temp_i,mod_path,found,i,m,l,module,name,parts,pyjs_try_err,save_track_module;
	available = $pyjs.available_modules_dict;
	if (pyjslib.bool(pyjslib.isUndefined(available))) {
		available = new pyjslib.Dict([]);
		var __m = pyjslib.list($pyjs.available_modules).__iter__();
		try {
			while (true) {
				var m = __m.next();
				
				available.__setitem__(m, false);
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
$pyjs.available_modules_dict = available;
	}
	searchList = pyjslib.list(searchList);
	found = false;
	var __mod_path = searchList.__iter__();
	try {
		while (true) {
			var mod_path = __mod_path.next();
			
			if (pyjslib.bool(available.__contains__(mod_path))) {
				found = true;
				break;
			}
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	if (pyjslib.bool(!(found))) {
		throw (pyjslib.ImportError( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add(String('No module named '), path) ) , String(' (context=')) ) , context) ) , String(')')) ) ));
	}
	module = null;
	try {
		module = $pyjs.loaded_modules[mod_path];
		if (pyjslib.bool(typeof module.__was_initialized__ != 'undefined')) {
			return null;
		}
	} catch(pyjs_try_err) {
		pyjs_try_err = pyjslib._errorMapping(pyjs_try_err);
		var pyjs_try_err_name = (typeof pyjs_try_err.__name__ == 'undefined' ? pyjs_try_err.name : pyjs_try_err.__name__ );
		$pyjs.__last_exception__ = {error: pyjs_try_err, module: pyjslib, try_lineno: 75};
		{
			$pyjs.__last_exception__.except_lineno = 80;
			err = pyjs_try_err;
		} 	}
	save_track_module = $pyjs.track.module;
	importName = String('');
	parts = mod_path.pysplit(String('.'));
	l = pyjslib.len(parts);
	var __temp_i = pyjslib.enumerate(parts).__iter__();
	try {
		while (true) {
			var temp_i = __temp_i.next();
				var i = temp_i.__getitem__(0);	var name = temp_i.__getitem__(1);
			importName += name;
module = $pyjs.loaded_modules[importName];
			if (pyjslib.bool(typeof module == 'undefined')) {
				throw (pyjslib.ImportError( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add(String('No module named '), importName) ) , String(', ')) ) , path) ) , String(' in context ')) ) , context) ) ));
			}
			if (pyjslib.bool(pyjslib.eq(i, 0))) {
$pyjs.__modules__[importName] = module;
			}
			if (pyjslib.bool(pyjslib.eq(l,  ( pyjs_op_add(i, 1) ) ))) {
				module(module_name);
			}
			else {
				module(null);
			}
			importName += String('.');
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
$pyjs.track.module = save_track_module;
};
pyjslib.__import__.__name__ = '__import__';

pyjslib.__import__.__bind_type__ = 0;
pyjslib.__import__.__args__ = [null,null,'searchList', 'path', 'context', 'module_name'];
pyjslib.load_module = function(path, parent_module, module_name, dynamic, async) {
	if ($pyjs.options.arg_count && (arguments.length < 3 || arguments.length > 5)) pyjs__exception_func_param(arguments.callee.__name__, 3, 5, arguments.length);
	if (typeof dynamic == 'undefined') dynamic=1;
	if (typeof async == 'undefined') async=false;


        var cache_file;
        var module = $pyjs.modules_hash[module_name];
        if (typeof module == 'function') {
            return true;
        }

        if (!dynamic) {
            // There's no way we can load a none dynamic module
            return false;
        }

        if (path == null)
        {
            path = './';
        }

        var override_name = sys.platform + "." + module_name;
        if (((sys.overrides != null) &&
             (sys.overrides.has_key(override_name))))
        {
            cache_file =  sys.overrides.__getitem__(override_name) ;
        }
        else
        {
            cache_file =  module_name ;
        }

        cache_file = (path + cache_file + '.cache.js' ) ;

        //alert("cache " + cache_file + " " + module_name + " " + parent_module);

        onload_fn = '';

        // this one tacks the script onto the end of the DOM
        pyjs_load_script(cache_file, onload_fn, async);

        try {
            loaded = (typeof $pyjs.modules_hash[module_name] == 'function');
        } catch ( e ) {
        }
        if (loaded) {
            return true;
        }
        return false;
    
};
pyjslib.load_module.__name__ = 'load_module';

pyjslib.load_module.__bind_type__ = 0;
pyjslib.load_module.__args__ = [null,null,'path', 'parent_module', 'module_name', 'dynamic', 'async'];
pyjslib.load_module_wait = function(proceed_fn, parent_mod, module_list, dynamic) {
	if ($pyjs.options.arg_count && arguments.length != 4) pyjs__exception_func_param(arguments.callee.__name__, 4, 4, arguments.length);

	module_list = module_list.getArray();

    var wait_count = 0;
    var timeoutperiod = 1;
    if (dynamic)
        var timeoutperiod = 1;

    var wait = function() {
        wait_count++;
        //write_dom(".");
        var loaded = true;
        for (var i in module_list) {
            if (typeof $pyjs.modules_hash[module_list[i]] != 'function') {
                loaded = false;
                break;
            }
        }
        if (!loaded) {
            setTimeout(wait, timeoutperiod);
        } else {
            if (proceed_fn.importDone)
                proceed_fn.importDone(proceed_fn);
            else
                proceed_fn();
            //$doc.body.removeChild(element);
        }
    };
    wait();

};
pyjslib.load_module_wait.__name__ = 'load_module_wait';

pyjslib.load_module_wait.__bind_type__ = 0;
pyjslib.load_module_wait.__args__ = [null,null,'proceed_fn', 'parent_mod', 'module_list', 'dynamic'];
pyjslib.Modload = (function(){
	var cls_instance = pyjs__class_instance('Modload');
	var cls_definition = new Object();
	cls_definition.__md5__ = 'fd8ad1e0f7caedb083afa5f9ae223beb';
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function(path, app_modlist, app_imported_fn, dynamic, parent_mod) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 5) pyjs__exception_func_param(arguments.callee.__name__, 6, 6, arguments.length+1);
		} else {
			var self = arguments[0];
			path = arguments[1];
			app_modlist = arguments[2];
			app_imported_fn = arguments[3];
			dynamic = arguments[4];
			parent_mod = arguments[5];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 6) pyjs__exception_func_param(arguments.callee.__name__, 6, 6, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'fd8ad1e0f7caedb083afa5f9ae223beb') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var depth,mod,modlist;
		self.app_modlist = app_modlist;
		self.app_imported_fn = app_imported_fn;
		self.path = path;
		self.dynamic = dynamic;
		self.parent_mod = parent_mod;
		self.modules = new pyjslib.Dict([]);
		var __modlist = self.app_modlist.__iter__();
		try {
			while (true) {
				var modlist = __modlist.next();
				
				var __mod = modlist.__iter__();
				try {
					while (true) {
						var mod = __mod.next();
						
						depth = pyjslib.len(mod.pysplit(String('.')));
						if (pyjslib.bool(!(self.modules.has_key(depth)))) {
							(self.modules===undefined?(function(){throw new TypeError('self.modules is undefined');})():(typeof self.modules == 'function' && self.__is_instance__?pyjslib.getattr(self, 'modules'):self.modules)).__setitem__(depth, new pyjslib.List([]));
						}
						(self.modules===undefined?(function(){throw new TypeError('self.modules is undefined');})():(typeof self.modules == 'function' && self.__is_instance__?pyjslib.getattr(self, 'modules'):self.modules)).__getitem__(depth).append(mod);
					}
				} catch (e) {
					if (e.__name__ != 'StopIteration') {
						throw e;
					}
				}
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		self.depths = self.modules.keys();
		self.depths.sort();
		self.depths.reverse();
		return null;
	}
	, 1, [null,null,'self', 'path', 'app_modlist', 'app_imported_fn', 'dynamic', 'parent_mod']);
	cls_definition.next = pyjs__bind_method(cls_instance, 'next', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'fd8ad1e0f7caedb083afa5f9ae223beb') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var app,depth;
		if (pyjslib.bool(!((self.dynamic===undefined?(function(){throw new TypeError('self.dynamic is undefined');})():(typeof self.dynamic == 'function' && self.__is_instance__?pyjslib.getattr(self, 'dynamic'):self.dynamic))))) {
			self.app_imported_fn();
			return null;
		}
		depth = self.depths.pop();
		var __app = (self.modules===undefined?(function(){throw new TypeError('self.modules is undefined');})():(typeof self.modules == 'function' && self.__is_instance__?pyjslib.getattr(self, 'modules'):self.modules)).__getitem__(depth).__iter__();
		try {
			while (true) {
				var app = __app.next();
				
				pyjslib.load_module((self.path===undefined?(function(){throw new TypeError('self.path is undefined');})():(typeof self.path == 'function' && self.__is_instance__?pyjslib.getattr(self, 'path'):self.path)), (self.parent_mod===undefined?(function(){throw new TypeError('self.parent_mod is undefined');})():(typeof self.parent_mod == 'function' && self.__is_instance__?pyjslib.getattr(self, 'parent_mod'):self.parent_mod)), app, (self.dynamic===undefined?(function(){throw new TypeError('self.dynamic is undefined');})():(typeof self.dynamic == 'function' && self.__is_instance__?pyjslib.getattr(self, 'dynamic'):self.dynamic)), true);
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		if (pyjslib.bool(pyjslib.eq(pyjslib.len((self.depths===undefined?(function(){throw new TypeError('self.depths is undefined');})():(typeof self.depths == 'function' && self.__is_instance__?pyjslib.getattr(self, 'depths'):self.depths))), 0))) {
			pyjslib.load_module_wait((self.app_imported_fn===undefined?(function(){throw new TypeError('self.app_imported_fn is undefined');})():(typeof self.app_imported_fn == 'function' && self.__is_instance__?pyjslib.getattr(self, 'app_imported_fn'):self.app_imported_fn)), (self.parent_mod===undefined?(function(){throw new TypeError('self.parent_mod is undefined');})():(typeof self.parent_mod == 'function' && self.__is_instance__?pyjslib.getattr(self, 'parent_mod'):self.parent_mod)), (self.modules===undefined?(function(){throw new TypeError('self.modules is undefined');})():(typeof self.modules == 'function' && self.__is_instance__?pyjslib.getattr(self, 'modules'):self.modules)).__getitem__(depth), (self.dynamic===undefined?(function(){throw new TypeError('self.dynamic is undefined');})():(typeof self.dynamic == 'function' && self.__is_instance__?pyjslib.getattr(self, 'dynamic'):self.dynamic)));
		}
		else {
			pyjslib.load_module_wait(pyjslib.getattr(self, String('next')), (self.parent_mod===undefined?(function(){throw new TypeError('self.parent_mod is undefined');})():(typeof self.parent_mod == 'function' && self.__is_instance__?pyjslib.getattr(self, 'parent_mod'):self.parent_mod)), (self.modules===undefined?(function(){throw new TypeError('self.modules is undefined');})():(typeof self.modules == 'function' && self.__is_instance__?pyjslib.getattr(self, 'modules'):self.modules)).__getitem__(depth), (self.dynamic===undefined?(function(){throw new TypeError('self.dynamic is undefined');})():(typeof self.dynamic == 'function' && self.__is_instance__?pyjslib.getattr(self, 'dynamic'):self.dynamic)));
		}
		return null;
	}
	, 1, [null,null,'self']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.object));
})();
pyjslib.get_module = function(module_name) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
	var ev;
	ev = pyjslib.sprintf(String('__mod = %s\x3B'), module_name);
pyjs_eval(ev);
	return pyjslib.__mod;
};
pyjslib.get_module.__name__ = 'get_module';

pyjslib.get_module.__bind_type__ = 0;
pyjslib.get_module.__args__ = [null,null,'module_name'];
pyjslib.preload_app_modules = function(path, app_modnames, app_imported_fn, dynamic, parent_mod) {
	if ($pyjs.options.arg_count && (arguments.length < 4 || arguments.length > 5)) pyjs__exception_func_param(arguments.callee.__name__, 4, 5, arguments.length);
	if (typeof parent_mod == 'undefined') parent_mod=null;
	var loader;
	loader = pyjslib.Modload(path, app_modnames, app_imported_fn, dynamic, parent_mod);
	loader.next();
	return null;
};
pyjslib.preload_app_modules.__name__ = 'preload_app_modules';

pyjslib.preload_app_modules.__bind_type__ = 0;
pyjslib.preload_app_modules.__args__ = [null,null,'path', 'app_modnames', 'app_imported_fn', 'dynamic', 'parent_mod'];
pyjslib.BaseException = (function(){
	var cls_instance = pyjs__class_instance('BaseException');
	var cls_definition = new Object();
	cls_definition.__md5__ = 'f1d727002fa12d6dd2e8d09d79693975';
	cls_definition.message = String('');
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			var args = new Array();
			for (var pyjs__va_arg = 0; pyjs__va_arg < arguments.length; pyjs__va_arg++) {
				var pyjs__arg = arguments[pyjs__va_arg];
				args.push(pyjs__arg);
			}
			args = pyjslib.Tuple(args);

			if ($pyjs.options.arg_count && arguments.length < 0) pyjs__exception_func_param(arguments.callee.__name__, 1, null, arguments.length+1);
		} else {
			var self = arguments[0];
			var args = new Array();
			for (var pyjs__va_arg = 1; pyjs__va_arg < arguments.length; pyjs__va_arg++) {
				var pyjs__arg = arguments[pyjs__va_arg];
				args.push(pyjs__arg);
			}
			args = pyjslib.Tuple(args);

			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length < 1) pyjs__exception_func_param(arguments.callee.__name__, 1, null, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'f1d727002fa12d6dd2e8d09d79693975') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		self.args = args;
		if (pyjslib.bool(pyjslib.eq(pyjslib.len(args), 1))) {
			self.message = args.__getitem__(0);
		}
		return null;
	}
	, 1, ['args',null,'self']);
	cls_definition.__getitem__ = pyjs__bind_method(cls_instance, '__getitem__', function(index) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'f1d727002fa12d6dd2e8d09d79693975') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.args.__getitem__(index);
	}
	, 1, [null,null,'self', 'index']);
	cls_definition.__str__ = pyjs__bind_method(cls_instance, '__str__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'f1d727002fa12d6dd2e8d09d79693975') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		if (pyjslib.bool((pyjslib.len((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args))) === 0))) {
			return String('');
		}
		else if (pyjslib.bool((pyjslib.len((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args))) === 1))) {
			return pyjslib.str((self.message===undefined?(function(){throw new TypeError('self.message is undefined');})():(typeof self.message == 'function' && self.__is_instance__?pyjslib.getattr(self, 'message'):self.message)));
		}
		return pyjslib.repr((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args)));
	}
	, 1, [null,null,'self']);
	cls_definition.__repr__ = pyjs__bind_method(cls_instance, '__repr__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'f1d727002fa12d6dd2e8d09d79693975') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return  ( pyjs_op_add((self.__name__===undefined?(function(){throw new TypeError('self.__name__ is undefined');})():(typeof self.__name__ == 'function' && self.__is_instance__?pyjslib.getattr(self, '__name__'):self.__name__)), pyjslib.repr((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args)))) ) ;
	}
	, 1, [null,null,'self']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.object));
})();
pyjslib.Exception = (function(){
	var cls_instance = pyjs__class_instance('Exception');
	var cls_definition = new Object();
	cls_definition.__md5__ = '9508f85d2f22b22663319149c9964f06';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.BaseException));
})();
pyjslib.StandardError = (function(){
	var cls_instance = pyjs__class_instance('StandardError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '213b930f4906fde5d906fa662003b3c2';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.Exception));
})();
pyjslib.TypeError = (function(){
	var cls_instance = pyjs__class_instance('TypeError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '89693a26cd50bcd20fcf9c303b63dce0';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.AttributeError = (function(){
	var cls_instance = pyjs__class_instance('AttributeError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '93d988c4d421ef5b62c9846e29d99ed5';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.NameError = (function(){
	var cls_instance = pyjs__class_instance('NameError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '300907dcbb08b00428dd22a96a858802';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.ValueError = (function(){
	var cls_instance = pyjs__class_instance('ValueError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '7493284ae4397433bf46f2f42cd1dafb';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.ImportError = (function(){
	var cls_instance = pyjs__class_instance('ImportError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '5307eac7178fc380fad56988ac2736cc';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.LookupError = (function(){
	var cls_instance = pyjs__class_instance('LookupError');
	var cls_definition = new Object();
	cls_definition.__md5__ = 'c21926c80c3c6bb9275cd8d8e799253a';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.RuntimeError = (function(){
	var cls_instance = pyjs__class_instance('RuntimeError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '2617eb57e03a2c46e8e339d9249c055b';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.StandardError));
})();
pyjslib.KeyError = (function(){
	var cls_instance = pyjs__class_instance('KeyError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '5675b861a8ea4c3633be50ae72ce774a';
	cls_definition.__str__ = pyjs__bind_method(cls_instance, '__str__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5675b861a8ea4c3633be50ae72ce774a') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		if (pyjslib.bool((pyjslib.len((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args))) === 0))) {
			return String('');
		}
		else if (pyjslib.bool((pyjslib.len((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args))) === 1))) {
			return pyjslib.repr((self.message===undefined?(function(){throw new TypeError('self.message is undefined');})():(typeof self.message == 'function' && self.__is_instance__?pyjslib.getattr(self, 'message'):self.message)));
		}
		return pyjslib.repr((self.args===undefined?(function(){throw new TypeError('self.args is undefined');})():(typeof self.args == 'function' && self.__is_instance__?pyjslib.getattr(self, 'args'):self.args)));
	}
	, 1, [null,null,'self']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.LookupError));
})();
pyjslib.IndexError = (function(){
	var cls_instance = pyjs__class_instance('IndexError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '30eec223583ad344b0f3f54815aad98d';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.LookupError));
})();
pyjslib.NotImplementedError = (function(){
	var cls_instance = pyjs__class_instance('NotImplementedError');
	var cls_definition = new Object();
	cls_definition.__md5__ = '463326706eddf9c8b49cb5fdb56595c8';
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.RuntimeError));
})();
pyjslib.init = function() {
	if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);


pyjslib._errorMapping = function(err) {
    if (err instanceof(ReferenceError) || err instanceof(TypeError)) {
        var message = '';
        try {
            message = err.message;
        } catch ( e) {
        }
        return pyjslib.AttributeError(message);
    }
    return err;
};

pyjslib.TryElse = function () { };
pyjslib.TryElse.prototype = new Error();
pyjslib.TryElse.__name__ = 'TryElse';
pyjslib.TryElse.message = 'TryElse';

pyjslib.StopIteration = function () { };
pyjslib.StopIteration.prototype = new Error();
pyjslib.StopIteration.__name__ = 'StopIteration';
pyjslib.StopIteration.message = 'StopIteration';

pyjslib.String_find = function(sub, start, end) {
    var pos=this.indexOf(sub, start);
    if (pyjslib.isUndefined(end)) return pos;

    if (pos + sub.length>end) return -1;
    return pos;
};

pyjslib.String_join = function(data) {
    var text="";

    if (data.constructor == Array) {
        return data.join(this);
    }
    else if (data.prototype.__md5__ == pyjslib.List.prototype.__md5__) {
        return data.l.join(this);
    }
    else if (pyjslib.isIteratable(data)) {
        var iter=data.__iter__();
        try {
            text+=iter.next();
            while (true) {
                var item=iter.next();
                text+=this + item;
            }
        }
        catch (e) {
            if (e.__name__ != 'StopIteration') throw e;
        }
    }

    return text;
};

pyjslib.String_isdigit = function() {
    return (this.match(/^\d+$/g) != null);
};

pyjslib.String_replace = function(old, replace, count) {
    var do_max=false;
    var start=0;
    var new_str="";
    var pos=0;

    if (!pyjslib.isString(old)) return this.__replace(old, replace);
    if (!pyjslib.isUndefined(count)) do_max=true;

    while (start<this.length) {
        if (do_max && !count--) break;

        pos=this.indexOf(old, start);
        if (pos<0) break;

        new_str+=this.substring(start, pos) + replace;
        start=pos+old.length;
    }
    if (start<this.length) new_str+=this.substring(start);

    return new_str;
};

pyjslib.String___contains__ = function(s){
    return this.indexOf(s)>=0;
};

pyjslib.String_split = function(sep, maxsplit) {
    var items=new pyjslib.List();
    var do_max=false;
    var subject=this;
    var start=0;
    var pos=0;

    if (pyjslib.isUndefined(sep) || pyjslib.isNull(sep)) {
        sep=" ";
        subject=subject.strip();
        subject=subject.replace(/\s+/g, sep);
    }
    else if (!pyjslib.isUndefined(maxsplit)) do_max=true;

    if (subject.length == 0) {
        return items;
    }

    while (start<subject.length) {
        if (do_max && !maxsplit--) break;

        pos=subject.indexOf(sep, start);
        if (pos<0) break;

        items.append(subject.substring(start, pos));
        start=pos+sep.length;
    }
    if (start<=subject.length) items.append(subject.substring(start));

    return items;
};

pyjslib.String___iter__ = function() {
    var i = 0;
    var s = this;
    return {
        'next': function() {
            if (i >= s.length) {
                throw pyjslib.StopIteration;
            }
            return s.substring(i++, i, 1);
        },
        '__iter__': function() {
            return this;
        }
    };
};

pyjslib.String_strip = function(chars) {
    return this.lstrip(chars).rstrip(chars);
};

pyjslib.String_lstrip = function(chars) {
    if (pyjslib.isUndefined(chars)) return this.replace(/^\s+/, "");
    if (chars.length == 0) return this;
    return this.replace(new RegExp("^[" + chars + "]+"), "");
};

pyjslib.String_rstrip = function(chars) {
    if (pyjslib.isUndefined(chars)) return this.replace(/\s+$/, "");
    if (chars.length == 0) return this;
    return this.replace(new RegExp("[" + chars + "]+$"), "");
};

pyjslib.String_startswith = function(prefix, start, end) {
    // FIXME: accept tuples as suffix (since 2.5)
    if (pyjslib.isUndefined(start)) start = 0;
    if (pyjslib.isUndefined(end)) end = this.length;

    if ((end - start) < prefix.length) return false;
    if (this.substr(start, prefix.length) == prefix) return true;
    return false;
};

pyjslib.String_endswith = function(suffix, start, end) {
    // FIXME: accept tuples as suffix (since 2.5)
    if (pyjslib.isUndefined(start)) start = 0;
    if (pyjslib.isUndefined(end)) end = this.length;

    if ((end - start) < suffix.length) return false;
    if (this.substr(end - suffix.length, suffix.length) == suffix) return true;
    return false;
};

pyjslib.String_ljust = function(width, fillchar) {
    if (typeof(width) != 'number' ||
        parseInt(width) != width) {
        throw (pyjslib.TypeError("an integer is required"));
    }
    if (pyjslib.isUndefined(fillchar)) fillchar = ' ';
    if (typeof(fillchar) != 'string' ||
        fillchar.length != 1) {
        throw (pyjslib.TypeError("ljust() argument 2 must be char, not " + typeof(fillchar)));
    }
    if (this.length >= width) return this;
    return this + new Array(width+1 - this.length).join(fillchar);
};

pyjslib.String_rjust = function(width, fillchar) {
    if (typeof(width) != 'number' ||
        parseInt(width) != width) {
        throw (pyjslib.TypeError("an integer is required"));
    }
    if (pyjslib.isUndefined(fillchar)) fillchar = ' ';
    if (typeof(fillchar) != 'string' ||
        fillchar.length != 1) {
        throw (pyjslib.TypeError("rjust() argument 2 must be char, not " + typeof(fillchar)));
    }
    if (this.length >= width) return this;
    return new Array(width + 1 - this.length).join(fillchar) + this;
};

pyjslib.String_center = function(width, fillchar) {
    if (typeof(width) != 'number' ||
        parseInt(width) != width) {
        throw (pyjslib.TypeError("an integer is required"));
    }
    if (pyjslib.isUndefined(fillchar)) fillchar = ' ';
    if (typeof(fillchar) != 'string' ||
        fillchar.length != 1) {
        throw (pyjslib.TypeError("center() argument 2 must be char, not " + typeof(fillchar)));
    }
    if (this.length >= width) return this;
    padlen = width - this.length;
    right = Math.ceil(padlen / 2);
    left = padlen - right;
    return new Array(left+1).join(fillchar) + this + new Array(right+1).join(fillchar);
};

pyjslib.String___getitem__ = function(idx) {
    if (idx < 0) idx += this.length;
    if (idx < 0 || idx > this.length) {
        throw(pyjslib.IndexError("string index out of range"));
    }
    return this.charAt(idx);
};

pyjslib.abs = Math.abs;

String.prototype.__getitem__ = pyjslib.String___getitem__;
String.prototype.upper = String.prototype.toUpperCase;
String.prototype.lower = String.prototype.toLowerCase;
String.prototype.find=pyjslib.String_find;
String.prototype.join=pyjslib.String_join;
String.prototype.isdigit=pyjslib.String_isdigit;
String.prototype.__iter__=pyjslib.String___iter__;
String.prototype.__contains__=pyjslib.String___contains__;

String.prototype.__replace=String.prototype.replace;
String.prototype.replace=pyjslib.String_replace;

String.prototype.pysplit=pyjslib.String_split;
String.prototype.strip=pyjslib.String_strip;
String.prototype.lstrip=pyjslib.String_lstrip;
String.prototype.rstrip=pyjslib.String_rstrip;
String.prototype.startswith=pyjslib.String_startswith;
String.prototype.endswith=pyjslib.String_endswith;
String.prototype.ljust=pyjslib.String_ljust;
String.prototype.rjust=pyjslib.String_rjust;
String.prototype.center=pyjslib.String_center;

var str = String;

};
pyjslib.init.__name__ = 'init';

pyjslib.init.__bind_type__ = 0;
pyjslib.init.__args__ = [null,null];
pyjslib.Class = (function(){
	var cls_instance = pyjs__class_instance('Class');
	var cls_definition = new Object();
	cls_definition.__md5__ = 'fb75ea67a9c76c97a2201e52e795cd50';
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function(name) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			name = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'fb75ea67a9c76c97a2201e52e795cd50') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		self.name_ = name;
		return null;
	}
	, 1, [null,null,'self', 'name']);
	cls_definition.__str___ = pyjs__bind_method(cls_instance, '__str___', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'fb75ea67a9c76c97a2201e52e795cd50') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return (self.name_===undefined?(function(){throw new TypeError('self.name_ is undefined');})():(typeof self.name_ == 'function' && self.__is_instance__?pyjslib.getattr(self, 'name_'):self.name_));
	}
	, 1, [null,null,'self']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.object));
})();
pyjslib.eq = function(a, b) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if (a === null) {
        if (b === null) return true;
        return false;
    }
    if (b === null) {
        return false;
    }
    if ((typeof a == 'object' || typeof a == 'function') && typeof a.__cmp__ == 'function') {
        return a.__cmp__(b) == 0;
    } else if ((typeof b == 'object' || typeof b == 'function') && typeof b.__cmp__ == 'function') {
        return b.__cmp__(a) == 0;
    }
    return a == b;
    
};
pyjslib.eq.__name__ = 'eq';

pyjslib.eq.__bind_type__ = 0;
pyjslib.eq.__args__ = [null,null,'a', 'b'];
pyjslib.cmp = function(a, b) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if (a === null) {
        if (b === null) return 0;
        return -1;
    }
    if (b === null) {
        return 1;
    }
    if ((typeof a == 'object' || typeof a == 'function') && typeof a.__cmp__ == 'function') {
        return a.__cmp__(b);
    } else if ((typeof b == 'object' || typeof b == 'function') && typeof b.__cmp__ == 'function') {
        return -b.__cmp__(a);
    }
    if (a > b) return 1;
    if (b > a) return -1;
    return 0;
    
};
pyjslib.cmp.__name__ = 'cmp';

pyjslib.cmp.__bind_type__ = 0;
pyjslib.cmp.__args__ = [null,null,'a', 'b'];
pyjslib.bool = function(v) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    if (!v) return false;
    switch(typeof v){
    case 'boolean':
        return v;
    case 'object':
        if (v.__nonzero__){
            return v.__nonzero__();
        }else if (v.__len__){
            return v.__len__()>0;
        }
        return true;
    }
    return Boolean(v);
    
};
pyjslib.bool.__name__ = 'bool';

pyjslib.bool.__bind_type__ = 0;
pyjslib.bool.__args__ = [null,null,'v'];
pyjslib.List = (function(){
	var cls_instance = pyjs__class_instance('List');
	var cls_definition = new Object();
	cls_definition.__md5__ = '508d0e6c3505a20773757a607ed357d6';
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function(data) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 0 || arguments.length > 1)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			data = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof data == 'undefined') data=null;


        this.l = [];
        this.extend(data);
        
	}
	, 1, [null,null,'self', 'data']);
	cls_definition.append = pyjs__bind_method(cls_instance, 'append', function(item) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			item = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    this.l[this.l.length] = item;
	}
	, 1, [null,null,'self', 'item']);
	cls_definition.extend = pyjs__bind_method(cls_instance, 'extend', function(data) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			data = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        if (pyjslib.isArray(data)) {
            n = this.l.length;
            for (var i=0; i < data.length; i++) {
                this.l[n+i]=data[i];
                }
            }
        else if (pyjslib.isIteratable(data)) {
            var iter=data.__iter__();
            var i=this.l.length;
            try {
                while (true) {
                    var item=iter.next();
                    this.l[i++]=item;
                    }
                }
            catch (e) {
                if (e.__name__ != 'StopIteration') throw e;
                }
            }
        
	}
	, 1, [null,null,'self', 'data']);
	cls_definition.remove = pyjs__bind_method(cls_instance, 'remove', function(value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			value = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var index=this.index(value);
        if (index<0) return false;
        this.l.splice(index, 1);
        return true;
        
	}
	, 1, [null,null,'self', 'value']);
	cls_definition.index = pyjs__bind_method(cls_instance, 'index', function(value, start) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			value = arguments[1];
			start = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 2 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof start == 'undefined') start=0;


        var length=this.l.length;
        for (var i=start; i<length; i++) {
            if (this.l[i]==value) {
                return i;
                }
            }
        
		throw (pyjslib.ValueError(String('list.index(x): x not in list')));
		return null;
	}
	, 1, [null,null,'self', 'value', 'start']);
	cls_definition.insert = pyjs__bind_method(cls_instance, 'insert', function(index, value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			value = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    var a = this.l; this.l=a.slice(0, index).concat(value, a.slice(index));
	}
	, 1, [null,null,'self', 'index', 'value']);
	cls_definition.pop = pyjs__bind_method(cls_instance, 'pop', function(index) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 0 || arguments.length > 1)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof index == 'undefined') index=-1;


        if (index<0) index = this.l.length + index;
        var a = this.l[index];
        this.l.splice(index, 1);
        return a;
        
	}
	, 1, [null,null,'self', 'index']);
	cls_definition.__cmp__ = pyjs__bind_method(cls_instance, '__cmp__', function(l) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			l = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var x,ll;
		if (pyjslib.bool(!(pyjslib.isinstance(l, pyjslib.List)))) {
			return -1;
		}
		ll =  ( pyjslib.len(self) - pyjslib.len(l) ) ;
		if (pyjslib.bool(!pyjslib.eq(ll, 0))) {
			return ll;
		}
		var __x = pyjslib.range(pyjslib.len(l)).__iter__();
		try {
			while (true) {
				var x = __x.next();
				
				ll = pyjslib.cmp(self.__getitem__(x), l.__getitem__(x));
				if (pyjslib.bool(!pyjslib.eq(ll, 0))) {
					return ll;
				}
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		return 0;
	}
	, 1, [null,null,'self', 'l']);
	cls_definition.slice = pyjs__bind_method(cls_instance, 'slice', function(lower, upper) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			lower = arguments[1];
			upper = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        if (upper==null) return pyjslib.List(this.l.slice(lower));
        return pyjslib.List(this.l.slice(lower, upper));
        
	}
	, 1, [null,null,'self', 'lower', 'upper']);
	cls_definition.__getitem__ = pyjs__bind_method(cls_instance, '__getitem__', function(index) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        if (index<0) index = this.l.length + index;
        return this.l[index];
        
	}
	, 1, [null,null,'self', 'index']);
	cls_definition.__setitem__ = pyjs__bind_method(cls_instance, '__setitem__', function(index, value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			value = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    this.l[index]=value;
	}
	, 1, [null,null,'self', 'index', 'value']);
	cls_definition.__delitem__ = pyjs__bind_method(cls_instance, '__delitem__', function(index) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    this.l.splice(index, 1);
	}
	, 1, [null,null,'self', 'index']);
	cls_definition.__len__ = pyjs__bind_method(cls_instance, '__len__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    return this.l.length;
	}
	, 1, [null,null,'self']);
	cls_definition.__contains__ = pyjs__bind_method(cls_instance, '__contains__', function(value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			value = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var err,pyjs_try_err;
		try {
			self.index(value);
		} catch(pyjs_try_err) {
			pyjs_try_err = pyjslib._errorMapping(pyjs_try_err);
			var pyjs_try_err_name = (typeof pyjs_try_err.__name__ == 'undefined' ? pyjs_try_err.name : pyjs_try_err.__name__ );
			$pyjs.__last_exception__ = {error: pyjs_try_err, module: pyjslib, try_lineno: 753};
			if (pyjs_try_err_name == pyjslib.ValueError.__name__) {
				$pyjs.__last_exception__.except_lineno = 755;
				err = pyjs_try_err;
				return false;
			} else { throw pyjs_try_err; }
		}
		return true;
	}
	, 1, [null,null,'self', 'value']);
	cls_definition.__iter__ = pyjs__bind_method(cls_instance, '__iter__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var i = 0;
        var l = this.l;
        return {
            'next': function() {
                if (i >= l.length) {
                    throw pyjslib.StopIteration;
                }
                return l[i++];
            },
            '__iter__': function() {
                return this;
            }
        };
        
	}
	, 1, [null,null,'self']);
	cls_definition.reverse = pyjs__bind_method(cls_instance, 'reverse', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    this.l.reverse();
	}
	, 1, [null,null,'self']);
	cls_definition.sort = pyjs__bind_method(cls_instance, 'sort', function(compareFunc, keyFunc, reverse) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 0 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 1, 4, arguments.length+1);
		} else {
			var self = arguments[0];
			compareFunc = arguments[1];
			keyFunc = arguments[2];
			reverse = arguments[3];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 4)) pyjs__exception_func_param(arguments.callee.__name__, 1, 4, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof compareFunc == 'undefined') compareFunc=null;
		if (typeof keyFunc == 'undefined') keyFunc=null;
		if (typeof reverse == 'undefined') reverse=false;
		var thisSort1,thisSort2,thisSort3;
		if (pyjslib.bool(!(compareFunc))) {
			compareFunc = pyjslib.cmp;
		}
		if (pyjslib.bool((keyFunc) && (reverse))) {
			thisSort1 = function(a, b) {
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

				return -compareFunc(keyFunc(a), keyFunc(b));
			};
			thisSort1.__name__ = 'thisSort1';

			thisSort1.__bind_type__ = 0;
			thisSort1.__args__ = [null,null,'a', 'b'];
			self.l.sort(thisSort1);
		}
		else if (pyjslib.bool(keyFunc)) {
			thisSort2 = function(a, b) {
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

				return compareFunc(keyFunc(a), keyFunc(b));
			};
			thisSort2.__name__ = 'thisSort2';

			thisSort2.__bind_type__ = 0;
			thisSort2.__args__ = [null,null,'a', 'b'];
			self.l.sort(thisSort2);
		}
		else if (pyjslib.bool(reverse)) {
			thisSort3 = function(a, b) {
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

				return -compareFunc(a, b);
			};
			thisSort3.__name__ = 'thisSort3';

			thisSort3.__bind_type__ = 0;
			thisSort3.__args__ = [null,null,'a', 'b'];
			self.l.sort(thisSort3);
		}
		else {
			self.l.sort(compareFunc);
		}
		return null;
	}
	, 1, [null,null,'self', 'compareFunc', 'keyFunc', 'reverse']);
	cls_definition.getArray = pyjs__bind_method(cls_instance, 'getArray', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return (self.l===undefined?(function(){throw new TypeError('self.l is undefined');})():(typeof self.l == 'function' && self.__is_instance__?pyjslib.getattr(self, 'l'):self.l));
	}
	, 1, [null,null,'self']);
	cls_definition.__str__ = pyjs__bind_method(cls_instance, '__str__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.__repr__();
	}
	, 1, [null,null,'self']);
	cls_definition.__repr__ = pyjs__bind_method(cls_instance, '__repr__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var s = "[";
        for (var i=0; i < self.l.length; i++) {
            s += pyjslib.repr(self.l[i]);
            if (i < self.l.length - 1)
                s += ", ";
        }
        s += "]";
        return s;
        
	}
	, 1, [null,null,'self']);
	cls_definition.__add__ = pyjs__bind_method(cls_instance, '__add__', function(other) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			other = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '508d0e6c3505a20773757a607ed357d6') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var tmp;
		tmp = pyjslib.list(self);
		tmp.extend(other);
		return tmp;
	}
	, 1, [null,null,'self', 'other']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.object));
})();
pyjslib.list = pyjslib.List;
pyjslib.Tuple = (function(){
	var cls_instance = pyjs__class_instance('Tuple');
	var cls_definition = new Object();
	cls_definition.__md5__ = 'da937b691be08f69bffa1cb8248d3d11';
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function(data) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 0 || arguments.length > 1)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			data = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof data == 'undefined') data=null;


        this.l = [];
        if (pyjslib.isArray(data)) {
            n = this.l.length;
            for (var i=0; i < data.length; i++) {
                this.l[n+i]=data[i];
                }
            }
        else if (pyjslib.isIteratable(data)) {
            var iter=data.__iter__();
            var i=this.l.length;
            try {
                while (true) {
                    var item=iter.next();
                    this.l[i++]=item;
                    }
                }
            catch (e) {
                if (e.__name__ != 'StopIteration') throw e;
                }
            }
        
	}
	, 1, [null,null,'self', 'data']);
	cls_definition.__cmp__ = pyjs__bind_method(cls_instance, '__cmp__', function(l) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			l = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var x,ll;
		if (pyjslib.bool(!(pyjslib.isinstance(l, pyjslib.Tuple)))) {
			return 1;
		}
		ll =  ( pyjslib.len(self) - pyjslib.len(l) ) ;
		if (pyjslib.bool(!pyjslib.eq(ll, 0))) {
			return ll;
		}
		var __x = pyjslib.range(pyjslib.len(l)).__iter__();
		try {
			while (true) {
				var x = __x.next();
				
				ll = pyjslib.cmp(self.__getitem__(x), l.__getitem__(x));
				if (pyjslib.bool(!pyjslib.eq(ll, 0))) {
					return ll;
				}
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		return 0;
	}
	, 1, [null,null,'self', 'l']);
	cls_definition.slice = pyjs__bind_method(cls_instance, 'slice', function(lower, upper) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			lower = arguments[1];
			upper = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        if (upper==null) return pyjslib.Tuple(this.l.slice(lower));
        return pyjslib.Tuple(this.l.slice(lower, upper));
        
	}
	, 1, [null,null,'self', 'lower', 'upper']);
	cls_definition.__getitem__ = pyjs__bind_method(cls_instance, '__getitem__', function(index) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			index = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        if (index<0) index = this.l.length + index;
        return this.l[index];
        
	}
	, 1, [null,null,'self', 'index']);
	cls_definition.__len__ = pyjs__bind_method(cls_instance, '__len__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

    return this.l.length;
	}
	, 1, [null,null,'self']);
	cls_definition.__contains__ = pyjs__bind_method(cls_instance, '__contains__', function(value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			value = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var length=this.l.length;
        for (var i=0; i<length; i++) {
            if (this.l[i]===value) {
                return true;
                }
            }
        
		return false;
	}
	, 1, [null,null,'self', 'value']);
	cls_definition.__iter__ = pyjs__bind_method(cls_instance, '__iter__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var i = 0;
        var l = this.l;
        return {
            'next': function() {
                if (i >= l.length) {
                    throw pyjslib.StopIteration;
                }
                return l[i++];
            },
            '__iter__': function() {
                return this;
            }
        };
        
	}
	, 1, [null,null,'self']);
	cls_definition.getArray = pyjs__bind_method(cls_instance, 'getArray', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return (self.l===undefined?(function(){throw new TypeError('self.l is undefined');})():(typeof self.l == 'function' && self.__is_instance__?pyjslib.getattr(self, 'l'):self.l));
	}
	, 1, [null,null,'self']);
	cls_definition.__str__ = pyjs__bind_method(cls_instance, '__str__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.__repr__();
	}
	, 1, [null,null,'self']);
	cls_definition.__repr__ = pyjs__bind_method(cls_instance, '__repr__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var s = "(";
        for (var i=0; i < self.l.length; i++) {
            s += pyjslib.repr(self.l[i]);
            if (i < self.l.length - 1)
                s += ", ";
        }
        if (self.l.length == 1)
            s += ",";
        s += ")";
        return s;
        
	}
	, 1, [null,null,'self']);
	cls_definition.__add__ = pyjs__bind_method(cls_instance, '__add__', function(other) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			other = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== 'da937b691be08f69bffa1cb8248d3d11') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var tmp;
		tmp = pyjslib.list(self);
		tmp.extend(other);
		return pyjslib.tuple(tmp);
	}
	, 1, [null,null,'self', 'other']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.object));
})();
pyjslib.tuple = pyjslib.Tuple;
pyjslib.Dict = (function(){
	var cls_instance = pyjs__class_instance('Dict');
	var cls_definition = new Object();
	cls_definition.__md5__ = '5c6ee03477beebb21146b6d470dadff7';
	cls_definition.__init__ = pyjs__bind_method(cls_instance, '__init__', function(data) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 0 || arguments.length > 1)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			data = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof data == 'undefined') data=null;


        this.d = {};

        if (pyjslib.isArray(data)) {
            for (var i in data) {
                var item=data[i];
                this.__setitem__(item[0], item[1]);
                //var sKey=pyjslib.hash(item[0]);
                //this.d[sKey]=item[1];
                }
            }
        else if (pyjslib.isIteratable(data)) {
            var iter=data.__iter__();
            try {
                while (true) {
                    var item=iter.next();
                    this.__setitem__(item.__getitem__(0), item.__getitem__(1));
                    }
                }
            catch (e) {
                if (e.__name__ != 'StopIteration') throw e;
                }
            }
        else if (pyjslib.isObject(data)) {
            for (var key in data) {
                this.__setitem__(key, data[key]);
                }
            }
        
	}
	, 1, [null,null,'self', 'data']);
	cls_definition.__setitem__ = pyjs__bind_method(cls_instance, '__setitem__', function(key, value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			value = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var sKey = pyjslib.hash(key);
        this.d[sKey]=[key, value];
        
	}
	, 1, [null,null,'self', 'key', 'value']);
	cls_definition.__getitem__ = pyjs__bind_method(cls_instance, '__getitem__', function(key) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var sKey = pyjslib.hash(key);
        var value=this.d[sKey];
        if (pyjslib.isUndefined(value)){
            throw pyjslib.KeyError(key);
        }
        return value[1];
        
	}
	, 1, [null,null,'self', 'key']);
	cls_definition.__nonzero__ = pyjs__bind_method(cls_instance, '__nonzero__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        for (var i in this.d){
            return true;
        }
        return false;
        
	}
	, 1, [null,null,'self']);
	cls_definition.__len__ = pyjs__bind_method(cls_instance, '__len__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var size=0;
        for (var i in this.d) size++;
        return size;
        
	}
	, 1, [null,null,'self']);
	cls_definition.has_key = pyjs__bind_method(cls_instance, 'has_key', function(key) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.__contains__(key);
	}
	, 1, [null,null,'self', 'key']);
	cls_definition.__delitem__ = pyjs__bind_method(cls_instance, '__delitem__', function(key) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var sKey = pyjslib.hash(key);
        delete this.d[sKey];
        
	}
	, 1, [null,null,'self', 'key']);
	cls_definition.__contains__ = pyjs__bind_method(cls_instance, '__contains__', function(key) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var sKey = pyjslib.hash(key);
        return (pyjslib.isUndefined(this.d[sKey])) ? false : true;
        
	}
	, 1, [null,null,'self', 'key']);
	cls_definition.keys = pyjs__bind_method(cls_instance, 'keys', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var keys=new pyjslib.List();
        for (var key in this.d) {
            keys.append(this.d[key][0]);
        }
        return keys;
        
	}
	, 1, [null,null,'self']);
	cls_definition.values = pyjs__bind_method(cls_instance, 'values', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var values=new pyjslib.List();
        for (var key in this.d) values.append(this.d[key][1]);
        return values;
        
	}
	, 1, [null,null,'self']);
	cls_definition.items = pyjs__bind_method(cls_instance, 'items', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var items = new pyjslib.List();
        for (var key in this.d) {
          var kv = this.d[key];
          items.append(new pyjslib.List(kv));
          }
          return items;
        
	}
	, 1, [null,null,'self']);
	cls_definition.__iter__ = pyjs__bind_method(cls_instance, '__iter__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.keys().__iter__();
	}
	, 1, [null,null,'self']);
	cls_definition.iterkeys = pyjs__bind_method(cls_instance, 'iterkeys', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.__iter__();
	}
	, 1, [null,null,'self']);
	cls_definition.itervalues = pyjs__bind_method(cls_instance, 'itervalues', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.values().__iter__();
		return null;
	}
	, 1, [null,null,'self']);
	cls_definition.iteritems = pyjs__bind_method(cls_instance, 'iteritems', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.items().__iter__();
		return null;
	}
	, 1, [null,null,'self']);
	cls_definition.setdefault = pyjs__bind_method(cls_instance, 'setdefault', function(key, default_value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			default_value = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		if (pyjslib.bool(!(self.has_key(key)))) {
			self.__setitem__(key, default_value);
		}
		return self.__getitem__(key);
	}
	, 1, [null,null,'self', 'key', 'default_value']);
	cls_definition.get = pyjs__bind_method(cls_instance, 'get', function(key, default_value) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length+1);
		} else {
			var self = arguments[0];
			key = arguments[1];
			default_value = arguments[2];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && (arguments.length < 2 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		if (typeof default_value == 'undefined') default_value=null;

		if (pyjslib.bool(!(self.has_key(key)))) {
			return default_value;
		}
		return self.__getitem__(key);
	}
	, 1, [null,null,'self', 'key', 'default_value']);
	cls_definition.update = pyjs__bind_method(cls_instance, 'update', function(d) {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
		} else {
			var self = arguments[0];
			d = arguments[1];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var k,temp_k,v;
		var __temp_k = d.iteritems().__iter__();
		try {
			while (true) {
				var temp_k = __temp_k.next();
						var k = temp_k.__getitem__(0);		var v = temp_k.__getitem__(1);
				self.__setitem__(k, v);
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		return null;
	}
	, 1, [null,null,'self', 'd']);
	cls_definition.pop = pyjs__bind_method(cls_instance, 'pop', function(k) {
		if (this.__is_instance__ === true) {
			var self = this;
			var d = new Array();
			for (var pyjs__va_arg = 1; pyjs__va_arg < arguments.length; pyjs__va_arg++) {
				var pyjs__arg = arguments[pyjs__va_arg];
				d.push(pyjs__arg);
			}
			d = pyjslib.Tuple(d);

			if ($pyjs.options.arg_count && arguments.length < 1) pyjs__exception_func_param(arguments.callee.__name__, 2, null, arguments.length+1);
		} else {
			var self = arguments[0];
			k = arguments[1];
			var d = new Array();
			for (var pyjs__va_arg = 2; pyjs__va_arg < arguments.length; pyjs__va_arg++) {
				var pyjs__arg = arguments[pyjs__va_arg];
				d.push(pyjs__arg);
			}
			d = pyjslib.Tuple(d);

			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length < 2) pyjs__exception_func_param(arguments.callee.__name__, 2, null, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var err,res,pyjs_try_err;
		if (pyjslib.bool((pyjslib.cmp(pyjslib.len(d), 1) == 1))) {
			throw (pyjslib.TypeError(pyjslib.sprintf(String('pop expected at most 2 arguments, got %s'),  ( pyjs_op_add(1, pyjslib.len(d)) ) )));
		}
		try {
			res = self.__getitem__(k);
    self.__delitem__(k);
			return res;
		} catch(pyjs_try_err) {
			pyjs_try_err = pyjslib._errorMapping(pyjs_try_err);
			var pyjs_try_err_name = (typeof pyjs_try_err.__name__ == 'undefined' ? pyjs_try_err.name : pyjs_try_err.__name__ );
			$pyjs.__last_exception__ = {error: pyjs_try_err, module: pyjslib, try_lineno: 1113};
			if (pyjs_try_err_name == pyjslib.KeyError.__name__) {
				$pyjs.__last_exception__.except_lineno = 1117;
				err = pyjs_try_err;
				if (pyjslib.bool(d)) {
					return d.__getitem__(0);
				}
				else {
					throw ($pyjs.__last_exception__?$pyjs.__last_exception__.error:pyjslib.TypeError('exceptions must be classes, instances, or strings (deprecated), not NoneType'));
				}
			} else { throw pyjs_try_err; }
		}
		return null;
	}
	, 1, ['d',null,'self', 'k']);
	cls_definition.popitem = pyjs__bind_method(cls_instance, 'popitem', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}
		var k,temp_k,v;
		var __temp_k = self.iteritems().__iter__();
		try {
			while (true) {
				var temp_k = __temp_k.next();
						var k = temp_k.__getitem__(0);		var v = temp_k.__getitem__(1);
				break;
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
    self.__delitem__(k);
		return new pyjslib.Tuple([k, v]);
	}
	, 1, [null,null,'self']);
	cls_definition.getObject = pyjs__bind_method(cls_instance, 'getObject', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return (self.d===undefined?(function(){throw new TypeError('self.d is undefined');})():(typeof self.d == 'function' && self.__is_instance__?pyjslib.getattr(self, 'd'):self.d));
	}
	, 1, [null,null,'self']);
	cls_definition.copy = pyjs__bind_method(cls_instance, 'copy', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return pyjslib.Dict(self.items());
	}
	, 1, [null,null,'self']);
	cls_definition.__str__ = pyjs__bind_method(cls_instance, '__str__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}

		return self.__repr__();
	}
	, 1, [null,null,'self']);
	cls_definition.__repr__ = pyjs__bind_method(cls_instance, '__repr__', function() {
		if (this.__is_instance__ === true) {
			var self = this;
			if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length+1);
		} else {
			var self = arguments[0];
			if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
			if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		}
		if ($pyjs.options.arg_instance_type) {
			if (self.prototype.__md5__ !== '5c6ee03477beebb21146b6d470dadff7') {
				if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
					pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				}
			}
		}


        var keys = new Array();
        for (var key in self.d)
            keys.push(key);

        var s = "{";
        for (var i=0; i<keys.length; i++) {
            var v = self.d[keys[i]];
            s += pyjslib.repr(v[0]) + ": " + pyjslib.repr(v[1]);
            if (i < keys.length-1)
                s += ", ";
        }
        s += "}";
        return s;
        
	}
	, 1, [null,null,'self']);
	return pyjs__class_function(cls_instance, cls_definition, 
	                            new Array(pyjslib.object));
})();
pyjslib.dict = pyjslib.Dict;
pyjslib._super = function(type_, object_or_type) {
	if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
	if (typeof object_or_type == 'undefined') object_or_type=null;

	if (pyjslib.bool(!(pyjslib._issubtype(object_or_type, type_)))) {
		throw (pyjslib.TypeError(String('super(type, obj): obj must be an instance or subtype of type')));
	}

    var fn = pyjs_type('super', type_.__mro__.slice(1), {});
    fn.__new__ = fn.__mro__[1].__new__;
    fn.__init__ = fn.__mro__[1].__init__;
    if (object_or_type.__is_instance__ === false) {
        return fn;
    }
    var obj = new Object();
    function wrapper(obj, name) {
        var fnwrap = function() {
            var args = [];
            for (var i = 0; i < arguments.length; i++) {
              args.push(arguments[i]);
            }
            return obj[name].apply(object_or_type,args);
        };
        fnwrap.__name__ = name;
    	fnwrap.__args__ = obj.__args__;
    	fnwrap.__bind_type__ = obj.__bind_type__;
        return fnwrap;
    }
    for (var m in fn) {
        if (typeof fn[m] == 'function') {
            obj[m] = wrapper(fn, m);
        }
    }
    return obj;
    
};
pyjslib._super.__name__ = '_super';

pyjslib._super.__bind_type__ = 0;
pyjslib._super.__args__ = [null,null,'type_', 'object_or_type'];
pyjslib.range = function(start, stop, step) {
	if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 1, 3, arguments.length);
	if (typeof stop == 'undefined') stop=null;
	if (typeof step == 'undefined') step=1;

	if (pyjslib.bool((stop === null))) {
		stop = start;
		start = 0;
	}

    return {
        'next': function() {
            if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) throw pyjslib.StopIteration;
            var rval = start;
            start += step;
            return rval;
            },
        '__iter__': function() {
            return this;
            }
        };
    
};
pyjslib.range.__name__ = 'range';

pyjslib.range.__bind_type__ = 0;
pyjslib.range.__args__ = [null,null,'start', 'stop', 'step'];
pyjslib.slice = function(object, lower, upper) {
	if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);


    if (pyjslib.isString(object)) {
        if (lower < 0) {
           lower = object.length + lower;
        }
        if (upper < 0) {
           upper = object.length + upper;
        }
        if (pyjslib.isNull(upper)) upper=object.length;
        return object.substring(lower, upper);
    }
    if (pyjslib.isObject(object) && object.slice)
        return object.slice(lower, upper);

    return null;
    
};
pyjslib.slice.__name__ = 'slice';

pyjslib.slice.__bind_type__ = 0;
pyjslib.slice.__args__ = [null,null,'object', 'lower', 'upper'];
pyjslib.str = function(text) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    if (pyjslib.hasattr(text,"__str__")) {
        return text.__str__();
    }
    return String(text);
    
};
pyjslib.str.__name__ = 'str';

pyjslib.str.__bind_type__ = 0;
pyjslib.str.__args__ = [null,null,'text'];
pyjslib.ord = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

	if (pyjslib.bool((pyjslib.isString(x)) && ((pyjslib.len(x) === 1)))) {

            return x.charCodeAt(0);
        
	}
	else {

            throw pyjslib.TypeError();
        
	}
	return null;
};
pyjslib.ord.__name__ = 'ord';

pyjslib.ord.__bind_type__ = 0;
pyjslib.ord.__args__ = [null,null,'x'];
pyjslib.chr = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


        return String.fromCharCode(x);
    
};
pyjslib.chr.__name__ = 'chr';

pyjslib.chr.__bind_type__ = 0;
pyjslib.chr.__args__ = [null,null,'x'];
pyjslib.is_basetype = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


       var t = typeof(x);
       return t == 'boolean' ||
       t == 'function' ||
       t == 'number' ||
       t == 'string' ||
       t == 'undefined';
    
};
pyjslib.is_basetype.__name__ = 'is_basetype';

pyjslib.is_basetype.__bind_type__ = 0;
pyjslib.is_basetype.__args__ = [null,null,'x'];
pyjslib.get_pyjs_classtype = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


        if (pyjslib.hasattr(x, "__is_instance__")) {
            var src = x.__name__;
            return src;
        }
        return null;
    
};
pyjslib.get_pyjs_classtype.__name__ = 'get_pyjs_classtype';

pyjslib.get_pyjs_classtype.__bind_type__ = 0;
pyjslib.get_pyjs_classtype.__args__ = [null,null,'x'];
pyjslib.repr = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

	if (pyjslib.bool(pyjslib.hasattr(x, String('__repr__')))) {
		return x.__repr__();
	}

       if (x === null)
           return "null";

       if (x === undefined)
           return "undefined";

       var t = typeof(x);

        //alert("repr typeof " + t + " : " + x);

       if (t == "boolean")
           return x.toString();

       if (t == "function")
           return "<function " + x.toString() + ">";

       if (t == "number")
           return x.toString();

       if (t == "string") {
           if (x.indexOf("'") == -1)
               return "'" + x + "'";
           if (x.indexOf('"') == -1)
               return '"' + x + '"';
           var s = x.replace(new RegExp('"', "g"), '\\"');
           return '"' + s + '"';
       }

       if (t == "undefined")
           return "undefined";

       // If we get here, x is an object.  See if it's a Pyjamas class.

       if (!pyjslib.hasattr(x, "__init__"))
           return "<" + x.toString() + ">";

       // Handle the common Pyjamas data types.

       var constructor = "UNKNOWN";

       constructor = pyjslib.get_pyjs_classtype(x);

        //alert("repr constructor: " + constructor);

       // If we get here, the class isn't one we know -> return the class name.
       // Note that we replace underscores with dots so that the name will
       // (hopefully!) look like the original Python name.

       //var s = constructor.replace(new RegExp('_', "g"), '.');
       return "<" + constructor + " object>";
    
};
pyjslib.repr.__name__ = 'repr';

pyjslib.repr.__bind_type__ = 0;
pyjslib.repr.__args__ = [null,null,'x'];
pyjslib.float_ = function(text) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return parseFloat(text);
    
};
pyjslib.float_.__name__ = 'float_';

pyjslib.float_.__bind_type__ = 0;
pyjslib.float_.__args__ = [null,null,'text'];
pyjslib.int_ = function(text, radix) {
	if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
	if (typeof radix == 'undefined') radix=null;
	var _radix;
	_radix = radix;

    if (radix === null) {
        _radix = 10;
    } else {
        if (typeof text != 'string') {
            throw pyjslib.TypeError("int() can't convert non-string with explicit base");
        }
    }
    var i = parseInt(text, _radix);
    if (!isNaN(i)) {
        return i;
    }
    
	throw (pyjslib.ValueError(pyjslib.sprintf(String('invalid literal for int() with base %d: \x27%s\x27'), new pyjslib.Tuple([_radix, text]))));
	return null;
};
pyjslib.int_.__name__ = 'int_';

pyjslib.int_.__bind_type__ = 0;
pyjslib.int_.__args__ = [null,null,'text', 'radix'];
pyjslib.len = function(object) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    if (typeof object.__len__ == 'function') return object.__len__();
    if (typeof object.length != 'undefined') return object.length;
    if (object === null) return 0;
    throw pyjslib.TypeError("object has no len()");
    
};
pyjslib.len.__name__ = 'len';

pyjslib.len.__bind_type__ = 0;
pyjslib.len.__args__ = [null,null,'object'];
pyjslib.isinstance = function(object_, classinfo) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
	var ci;
	if (pyjslib.bool(pyjslib.isUndefined(object_))) {
		return false;
	}
if (classinfo.__name__ == 'int_') {
            return pyjslib.isNumber(object_); /* XXX TODO: check rounded? */
            }
        
if (classinfo.__name__ == 'str') {
            return pyjslib.isString(object_);
            }
        
	if (pyjslib.bool(!(pyjslib.isObject(object_)))) {
		return false;
	}
	if (pyjslib.bool(pyjslib._isinstance(classinfo, pyjslib.Tuple))) {
		var __ci = classinfo.__iter__();
		try {
			while (true) {
				var ci = __ci.next();
				
				if (pyjslib.bool(pyjslib.isinstance(object_, ci))) {
					return true;
				}
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		return false;
	}
	else {
		return pyjslib._isinstance(object_, classinfo);
	}
	return null;
};
pyjslib.isinstance.__name__ = 'isinstance';

pyjslib.isinstance.__bind_type__ = 0;
pyjslib.isinstance.__args__ = [null,null,'object_', 'classinfo'];
pyjslib._isinstance = function(object_, classinfo) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if (object_.__is_instance__ !== true) {
        return false;
    }
    for (var c in object_.__mro__) {
        if (object_.__mro__[c].__md5__ == classinfo.prototype.__md5__) return true;
    }
    return false;
    
};
pyjslib._isinstance.__name__ = '_isinstance';

pyjslib._isinstance.__bind_type__ = 0;
pyjslib._isinstance.__args__ = [null,null,'object_', 'classinfo'];
pyjslib._issubtype = function(object_, classinfo) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if (object_.__is_instance__ == null || classinfo.__is_instance__ == null) {
        return false;
    }
    for (var c in object_.__mro__) {
        if (object_.__mro__[c] == classinfo.prototype) return true;
    }
    return false;
    
};
pyjslib._issubtype.__name__ = '_issubtype';

pyjslib._issubtype.__bind_type__ = 0;
pyjslib._issubtype.__args__ = [null,null,'object_', 'classinfo'];
pyjslib.getattr = function(obj, name, default_value) {
	if ($pyjs.options.arg_count && (arguments.length < 2 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length);
	if (typeof default_value == 'undefined') default_value=null;


    if ((!pyjslib.isObject(obj))||(pyjslib.isUndefined(obj[name]))){
        if (arguments.length != 3){
            throw pyjslib.AttributeError(obj, name);
        }else{
        return default_value;
        }
    }
    if (!pyjslib.isFunction(obj[name])) return obj[name];
    var method = obj[name];
    var fnwrap = function() {
        var args = [];
        for (var i = 0; i < arguments.length; i++) {
          args.push(arguments[i]);
        }
        return method.apply(obj,args);
    };
    fnwrap.__name__ = name;
    fnwrap.__args__ = obj.__args__;
    fnwrap.__bind_type__ = obj.__bind_type__;
    return fnwrap;
    
};
pyjslib.getattr.__name__ = 'getattr';

pyjslib.getattr.__bind_type__ = 0;
pyjslib.getattr.__args__ = [null,null,'obj', 'name', 'default_value'];
pyjslib.delattr = function(obj, name) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if (!pyjslib.isObject(obj)) {
       throw pyjslib.AttributeError("'"+typeof(obj)+"' object has no attribute '"+name+"%s'");
    }
    if ((pyjslib.isUndefined(obj[name])) ||(typeof(obj[name]) == "function") ){
        throw pyjslib.AttributeError(obj.__name__+" instance has no attribute '"+ name+"'");
    }
    delete obj[name];
    
};
pyjslib.delattr.__name__ = 'delattr';

pyjslib.delattr.__bind_type__ = 0;
pyjslib.delattr.__args__ = [null,null,'obj', 'name'];
pyjslib.setattr = function(obj, name, value) {
	if ($pyjs.options.arg_count && arguments.length != 3) pyjs__exception_func_param(arguments.callee.__name__, 3, 3, arguments.length);


    if (!pyjslib.isObject(obj)) return null;

    obj[name] = value;

    
};
pyjslib.setattr.__name__ = 'setattr';

pyjslib.setattr.__bind_type__ = 0;
pyjslib.setattr.__args__ = [null,null,'obj', 'name', 'value'];
pyjslib.hasattr = function(obj, name) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if (!pyjslib.isObject(obj)) return false;
    if (pyjslib.isUndefined(obj[name])) return false;

    return true;
    
};
pyjslib.hasattr.__name__ = 'hasattr';

pyjslib.hasattr.__bind_type__ = 0;
pyjslib.hasattr.__args__ = [null,null,'obj', 'name'];
pyjslib.dir = function(obj) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    var properties=new pyjslib.List();
    for (property in obj) properties.append(property);
    return properties;
    
};
pyjslib.dir.__name__ = 'dir';

pyjslib.dir.__bind_type__ = 0;
pyjslib.dir.__args__ = [null,null,'obj'];
pyjslib.filter = function(obj, method, sequence) {
	if ($pyjs.options.arg_count && (arguments.length < 2 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length);
	if (typeof sequence == 'undefined') sequence=null;
	var items,item;
	items = new pyjslib.List([]);
	if (pyjslib.bool((sequence === null))) {
		sequence = method;
		method = obj;
		var __item = sequence.__iter__();
		try {
			while (true) {
				var item = __item.next();
				
				if (pyjslib.bool(method(item))) {
					items.append(item);
				}
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
	}
	else {
		var __item = sequence.__iter__();
		try {
			while (true) {
				var item = __item.next();
				
				if (pyjslib.bool(method.call_(obj, item))) {
					items.append(item);
				}
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
	}
	return items;
};
pyjslib.filter.__name__ = 'filter';

pyjslib.filter.__bind_type__ = 0;
pyjslib.filter.__args__ = [null,null,'obj', 'method', 'sequence'];
pyjslib.map = function(obj, method, sequence) {
	if ($pyjs.options.arg_count && (arguments.length < 2 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length);
	if (typeof sequence == 'undefined') sequence=null;
	var items,item;
	items = new pyjslib.List([]);
	if (pyjslib.bool((sequence === null))) {
		sequence = method;
		method = obj;
		var __item = sequence.__iter__();
		try {
			while (true) {
				var item = __item.next();
				
				items.append(method(item));
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
	}
	else {
		var __item = sequence.__iter__();
		try {
			while (true) {
				var item = __item.next();
				
				items.append(method.call_(obj, item));
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
	}
	return items;
};
pyjslib.map.__name__ = 'map';

pyjslib.map.__bind_type__ = 0;
pyjslib.map.__args__ = [null,null,'obj', 'method', 'sequence'];
pyjslib.enumerate = function(sequence) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
	var item,nextIndex,enumeration;
	enumeration = new pyjslib.List([]);
	nextIndex = 0;
	var __item = sequence.__iter__();
	try {
		while (true) {
			var item = __item.next();
			
			enumeration.append(new pyjslib.List([nextIndex, item]));
			nextIndex =  ( pyjs_op_add(nextIndex, 1) ) ;
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	return enumeration;
};
pyjslib.enumerate.__name__ = 'enumerate';

pyjslib.enumerate.__bind_type__ = 0;
pyjslib.enumerate.__args__ = [null,null,'sequence'];
pyjslib.min = function() {
	if ($pyjs.options.arg_count && arguments.length < 0) pyjs__exception_func_param(arguments.callee.__name__, 0, null, arguments.length);
	var sequence = new Array();
	for (var pyjs__va_arg = 0; pyjs__va_arg < arguments.length; pyjs__va_arg++) {
		var pyjs__arg = arguments[pyjs__va_arg];
		sequence.push(pyjs__arg);
	}
	sequence = pyjslib.Tuple(sequence);

	var item,minValue;
	if (pyjslib.bool(pyjslib.eq(pyjslib.len(sequence), 1))) {
		sequence = sequence.__getitem__(0);
	}
	minValue = null;
	var __item = sequence.__iter__();
	try {
		while (true) {
			var item = __item.next();
			
			if (pyjslib.bool((minValue === null))) {
				minValue = item;
			}
			else if (pyjslib.bool(pyjslib.eq(pyjslib.cmp(item, minValue), -1))) {
				minValue = item;
			}
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	return minValue;
};
pyjslib.min.__name__ = 'min';

pyjslib.min.__bind_type__ = 0;
pyjslib.min.__args__ = ['sequence',null];
pyjslib.max = function() {
	if ($pyjs.options.arg_count && arguments.length < 0) pyjs__exception_func_param(arguments.callee.__name__, 0, null, arguments.length);
	var sequence = new Array();
	for (var pyjs__va_arg = 0; pyjs__va_arg < arguments.length; pyjs__va_arg++) {
		var pyjs__arg = arguments[pyjs__va_arg];
		sequence.push(pyjs__arg);
	}
	sequence = pyjslib.Tuple(sequence);

	var item,maxValue;
	if (pyjslib.bool(pyjslib.eq(pyjslib.len(sequence), 1))) {
		sequence = sequence.__getitem__(0);
	}
	maxValue = null;
	var __item = sequence.__iter__();
	try {
		while (true) {
			var item = __item.next();
			
			if (pyjslib.bool((maxValue === null))) {
				maxValue = item;
			}
			else if (pyjslib.bool(pyjslib.eq(pyjslib.cmp(item, maxValue), 1))) {
				maxValue = item;
			}
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	return maxValue;
};
pyjslib.max.__name__ = 'max';

pyjslib.max.__bind_type__ = 0;
pyjslib.max.__args__ = ['sequence',null];
pyjslib.next_hash_id = 0;
pyjslib.hash = function(obj) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    if (obj == null) return null;

    if (obj.$H) return obj.$H;
    if (obj.__hash__) return obj.__hash__();
    if (obj.constructor == String || obj.constructor == Number || obj.constructor == Date) return obj;

    try {
        obj.$H = ++pyjslib.next_hash_id;
        return obj.$H;
    } catch (e) {
        return obj;
    }
    
};
pyjslib.hash.__name__ = 'hash';

pyjslib.hash.__bind_type__ = 0;
pyjslib.hash.__args__ = [null,null,'obj'];
pyjslib.isObject = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return (a != null && (typeof a == 'object')) || pyjslib.isFunction(a);
    
};
pyjslib.isObject.__name__ = 'isObject';

pyjslib.isObject.__bind_type__ = 0;
pyjslib.isObject.__args__ = [null,null,'a'];
pyjslib.isFunction = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return typeof a == 'function';
    
};
pyjslib.isFunction.__name__ = 'isFunction';

pyjslib.isFunction.__bind_type__ = 0;
pyjslib.isFunction.__args__ = [null,null,'a'];
pyjslib.callable = pyjslib.isFunction;
pyjslib.isString = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return typeof a == 'string';
    
};
pyjslib.isString.__name__ = 'isString';

pyjslib.isString.__bind_type__ = 0;
pyjslib.isString.__args__ = [null,null,'a'];
pyjslib.isNull = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return typeof a == 'object' && !a;
    
};
pyjslib.isNull.__name__ = 'isNull';

pyjslib.isNull.__bind_type__ = 0;
pyjslib.isNull.__args__ = [null,null,'a'];
pyjslib.isArray = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return pyjslib.isObject(a) && a.constructor == Array;
    
};
pyjslib.isArray.__name__ = 'isArray';

pyjslib.isArray.__bind_type__ = 0;
pyjslib.isArray.__args__ = [null,null,'a'];
pyjslib.isUndefined = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return typeof a == 'undefined';
    
};
pyjslib.isUndefined.__name__ = 'isUndefined';

pyjslib.isUndefined.__bind_type__ = 0;
pyjslib.isUndefined.__args__ = [null,null,'a'];
pyjslib.isIteratable = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return pyjslib.isString(a) || (pyjslib.isObject(a) && a.__iter__);
    
};
pyjslib.isIteratable.__name__ = 'isIteratable';

pyjslib.isIteratable.__bind_type__ = 0;
pyjslib.isIteratable.__args__ = [null,null,'a'];
pyjslib.isNumber = function(a) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);


    return typeof a == 'number' && isFinite(a);
    
};
pyjslib.isNumber.__name__ = 'isNumber';

pyjslib.isNumber.__bind_type__ = 0;
pyjslib.isNumber.__args__ = [null,null,'a'];
pyjslib.toJSObjects = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

	if (pyjslib.bool(pyjslib.isArray(x))) {

        var result = [];
        for(var k=0; k < x.length; k++) {
           var v = x[k];
           var tv = pyjslib.toJSObjects(v);
           result.push(tv);
        }
        return result;
        
	}
	if (pyjslib.bool(pyjslib.isObject(x))) {
		if (pyjslib.bool(pyjslib.isinstance(x, pyjslib.Dict))) {

            var o = x.getObject();
            var result = {};
            for (var i in o) {
               result[o[i][0].toString()] = o[i][1];
            }
            return pyjslib.toJSObjects(result);
            
		}
		else if (pyjslib.bool(pyjslib.isinstance(x, pyjslib.List))) {
			return pyjslib.toJSObjects((x.l===undefined?(function(){throw new TypeError('x.l is undefined');})():(typeof x.l == 'function' && x.__is_instance__?pyjslib.getattr(x, 'l'):x.l)));
		}
		else if (pyjslib.bool(pyjslib.hasattr(x, String('__class__')))) {
			return x;
		}
	}
	if (pyjslib.bool(pyjslib.isObject(x))) {

        var result = {};
        for(var k in x) {
            var v = x[k];
            var tv = pyjslib.toJSObjects(v);
            result[k] = tv;
            }
            return result;
         
	}
	return x;
};
pyjslib.toJSObjects.__name__ = 'toJSObjects';

pyjslib.toJSObjects.__bind_type__ = 0;
pyjslib.toJSObjects.__args__ = [null,null,'x'];
pyjslib.sprintf = function(strng, args) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
	var a,sprintf_dict,next_arg,remainder,nargs,argidx,formatarg,result,constructor,strlen,sprintf_list;
	constructor = pyjslib.get_pyjs_classtype(args);

    var re_dict = /([^%]*)%[(]([^)]+)[)]([#0\x20\0x2B-]*)(\d+)?(\.\d+)?[hlL]?(.)((.|\n)*)/;
    var re_list = /([^%]*)%([#0\x20\x2B-]*)(\*|(\d+))?(\.\d+)?[hlL]?(.)((.|\n)*)/;
    var re_exp = /(.*)([+-])(.*)/;

	strlen = pyjslib.len(strng);
	argidx = 0;
	nargs = 0;
	result = new pyjslib.List([]);
	remainder = strng;
	next_arg = function() {
		if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);
		var arg;
		if (pyjslib.bool(pyjslib.eq(argidx, nargs))) {
			throw (pyjslib.TypeError(String('not enough arguments for format string')));
		}
		arg = args.__getitem__(argidx);
		argidx += 1;
		return arg;
	};
	next_arg.__name__ = 'next_arg';

	next_arg.__bind_type__ = 0;
	next_arg.__args__ = [null,null];
	formatarg = function(flags, minlen, precision, conversion, param) {
		if ($pyjs.options.arg_count && arguments.length != 5) pyjs__exception_func_param(arguments.callee.__name__, 5, 5, arguments.length);
		var subst,numeric,padchar,left_padding;
		subst = String('');
		numeric = true;
		if (pyjslib.bool(!(minlen))) {
			minlen = 0;
		}
		else {
			minlen = pyjslib.int_(minlen);
		}
		if (pyjslib.bool(!(precision))) {
			precision = null;
		}
		else {
			precision = pyjslib.int_(precision);
		}
		left_padding = 1;
		if (pyjslib.bool((pyjslib.cmp(flags.find(String('-')), 0) != -1))) {
			left_padding = 0;
		}
		if (pyjslib.bool(pyjslib.eq(conversion, String('%')))) {
			numeric = false;
			subst = String('%');
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('c')))) {
			numeric = false;
			subst = pyjslib.chr(pyjslib.int_(param));
		}
		else if (pyjslib.bool((pyjslib.eq(conversion, String('d'))) || (pyjslib.eq(conversion, String('i'))) || (pyjslib.eq(conversion, String('u'))))) {
			subst = pyjslib.str(pyjslib.int_(param));
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('e')))) {
			if (pyjslib.bool((precision === null))) {
				precision = 6;
			}

            subst = re_exp.exec(String(param.toExponential(precision)));
            if (subst[3].length == 1) {
                subst = subst[1] + subst[2] + '0' + subst[3];
            } else {
                subst = subst[1] + subst[2] + subst[3];
            }
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('E')))) {
			if (pyjslib.bool((precision === null))) {
				precision = 6;
			}

            subst = re_exp.exec(String(param.toExponential(precision)).toUpperCase());
            if (subst[3].length == 1) {
                subst = subst[1] + subst[2] + '0' + subst[3];
            } else {
                subst = subst[1] + subst[2] + subst[3];
            }
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('f')))) {
			if (pyjslib.bool((precision === null))) {
				precision = 6;
			}

            subst = String(parseFloat(param).toFixed(precision));
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('F')))) {
			if (pyjslib.bool((precision === null))) {
				precision = 6;
			}

            subst = String(parseFloat(param).toFixed(precision)).toUpperCase();
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('g')))) {
			if (pyjslib.bool((pyjslib.cmp(flags.find(String('#')), 0) != -1))) {
				if (pyjslib.bool((precision === null))) {
					precision = 6;
				}
			}
			if (pyjslib.bool(((pyjslib.cmp(param, 1000000.0) != -1)) || ((pyjslib.cmp(param, 1e-05) == -1)))) {

                subst = String(precision == null ? param.toExponential() : param.toExponential().toPrecision(precision));
			}
			else {

                subst = String(precision == null ? parseFloat(param) : parseFloat(param).toPrecision(precision));
			}
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('G')))) {
			if (pyjslib.bool((pyjslib.cmp(flags.find(String('#')), 0) != -1))) {
				if (pyjslib.bool((precision === null))) {
					precision = 6;
				}
			}
			if (pyjslib.bool(((pyjslib.cmp(param, 1000000.0) != -1)) || ((pyjslib.cmp(param, 1e-05) == -1)))) {

                subst = String(precision == null ? param.toExponential() : param.toExponential().toPrecision(precision)).toUpperCase();
			}
			else {

                subst = String(precision == null ? parseFloat(param) : parseFloat(param).toPrecision(precision)).toUpperCase().toUpperCase();
			}
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('r')))) {
			numeric = false;
			subst = pyjslib.repr(param);
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('s')))) {
			numeric = false;
			subst = pyjslib.str(param);
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('o')))) {
			param = pyjslib.int_(param);

            subst = param.toString(8);
			if (pyjslib.bool(((pyjslib.cmp(flags.find(String('#')), 0) != -1)) && (!pyjslib.eq(subst, String('0'))))) {
				subst =  ( pyjs_op_add(String('0'), subst) ) ;
			}
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('x')))) {
			param = pyjslib.int_(param);

            subst = param.toString(16);
			if (pyjslib.bool((pyjslib.cmp(flags.find(String('#')), 0) != -1))) {
				if (pyjslib.bool(left_padding)) {
					subst = subst.rjust( ( minlen - 2 ) , String('0'));
				}
				subst =  ( pyjs_op_add(String('0x'), subst) ) ;
			}
		}
		else if (pyjslib.bool(pyjslib.eq(conversion, String('X')))) {
			param = pyjslib.int_(param);

            subst = param.toString(16).toUpperCase();
			if (pyjslib.bool((pyjslib.cmp(flags.find(String('#')), 0) != -1))) {
				if (pyjslib.bool(left_padding)) {
					subst = subst.rjust( ( minlen - 2 ) , String('0'));
				}
				subst =  ( pyjs_op_add(String('0X'), subst) ) ;
			}
		}
		else {
			throw (pyjslib.ValueError( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add(String('unsupported format character \x27'), conversion) ) , String('\x27 (')) ) , pyjslib.hex(pyjslib.ord(conversion))) ) , String(') at index ')) ) ,  (  ( strlen - pyjslib.len(remainder) )  - 1 ) ) ) ));
		}
		if (pyjslib.bool((minlen) && ((pyjslib.cmp(pyjslib.len(subst), minlen) == -1)))) {
			padchar = String(' ');
			if (pyjslib.bool((numeric) && (left_padding) && ((pyjslib.cmp(flags.find(String('0')), 0) != -1)))) {
				padchar = String('0');
			}
			if (pyjslib.bool(left_padding)) {
				subst = subst.rjust(minlen, padchar);
			}
			else {
				subst = subst.ljust(minlen, padchar);
			}
		}
		return subst;
	};
	formatarg.__name__ = 'formatarg';

	formatarg.__bind_type__ = 0;
	formatarg.__args__ = [null,null,'flags', 'minlen', 'precision', 'conversion', 'param'];
	sprintf_list = function(strng, args) {
		if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		var a,conversion,minlen,precision,param,flags,minlen_type,left;
		a = null;
		left = null;
		flags = null;
		precision = null;
		conversion = null;
		minlen = null;
		minlen_type = null;
    while (pyjslib.bool(remainder)) {

            a = re_list.exec(remainder);
		if (pyjslib.bool((a === null))) {
			result.append(remainder);
			break;
		}

            left = a[1]; flags = a[2];
            minlen = a[3]; precision = a[5]; conversion = a[6];
            remainder = a[7];
            if (typeof minlen == 'undefined') minlen = null;
            if (typeof precision == 'undefined') precision = null;
            if (typeof conversion == 'undefined') conversion = null;

		result.append(left);
		if (pyjslib.bool(pyjslib.eq(minlen, String('*')))) {
			minlen = next_arg();
minlen_type = typeof(minlen);
			if (pyjslib.bool((!pyjslib.eq(minlen_type, String('number'))) || (!pyjslib.eq(pyjslib.int_(minlen), minlen)))) {
				throw (pyjslib.TypeError(String('* wants int')));
			}
		}
		if (pyjslib.bool(!pyjslib.eq(conversion, String('%')))) {
			param = next_arg();
		}
		result.append(formatarg(flags, minlen, precision, conversion, param));
    }
		return null;
	};
	sprintf_list.__name__ = 'sprintf_list';

	sprintf_list.__bind_type__ = 0;
	sprintf_list.__args__ = [null,null,'strng', 'args'];
	sprintf_dict = function(strng, args) {
		if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		var a,conversion,minlen,precision,param,flags,key,arg,left;
		arg = args;
		argidx += 1;
		a = null;
		key = null;
		left = null;
		flags = null;
		precision = null;
		conversion = null;
		minlen = null;
    while (pyjslib.bool(remainder)) {

            a = re_dict.exec(remainder);
		if (pyjslib.bool((a === null))) {
			result.append(remainder);
			break;
		}

            left = a[1]; key = a[2]; flags = a[3];
            minlen = a[4]; precision = a[5]; conversion = a[6];
            remainder = a[7];
            if (typeof minlen == 'undefined') minlen = null;
            if (typeof precision == 'undefined') precision = null;
            if (typeof conversion == 'undefined') conversion = null;

		result.append(left);
		if (pyjslib.bool(!(arg.has_key(key)))) {
			throw (pyjslib.KeyError(key));
		}
		else {
			param = arg.__getitem__(key);
		}
		result.append(formatarg(flags, minlen, precision, conversion, param));
    }
		return null;
	};
	sprintf_dict.__name__ = 'sprintf_dict';

	sprintf_dict.__bind_type__ = 0;
	sprintf_dict.__args__ = [null,null,'strng', 'args'];
	a = null;

    a = re_dict.exec(strng);

	if (pyjslib.bool((a === null))) {
		if (pyjslib.bool(!pyjslib.eq(constructor, String('Tuple')))) {
			args = new pyjslib.Tuple([args]);
		}
		nargs = pyjslib.len(args);
		sprintf_list(strng, args);
		if (pyjslib.bool(!pyjslib.eq(argidx, nargs))) {
			throw (pyjslib.TypeError(String('not all arguments converted during string formatting')));
		}
	}
	else {
		if (pyjslib.bool(!pyjslib.eq(constructor, String('Dict')))) {
			throw (pyjslib.TypeError(String('format requires a mapping')));
		}
		sprintf_dict(strng, args);
	}
	return String('').join(result);
};
pyjslib.sprintf.__name__ = 'sprintf';

pyjslib.sprintf.__bind_type__ = 0;
pyjslib.sprintf.__args__ = [null,null,'strng', 'args'];
pyjslib.printFunc = function(objs, newline) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);


    if ($wnd.console==undefined)  return;
    var s = "";
    for(var i=0; i < objs.length; i++) {
        if(s != "") s += " ";
        s += objs[i];
    }
    console.debug(s);
    
};
pyjslib.printFunc.__name__ = 'printFunc';

pyjslib.printFunc.__bind_type__ = 0;
pyjslib.printFunc.__args__ = [null,null,'objs', 'newline'];
pyjslib.type = function(clsname, bases, methods) {
	if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 1, 3, arguments.length);
	if (typeof bases == 'undefined') bases=null;
	if (typeof methods == 'undefined') methods=null;
	var k,mth;
 var mths = {}; 
	if (pyjslib.bool(methods)) {
		var __k = methods.keys().__iter__();
		try {
			while (true) {
				var k = __k.next();
				
				mth = methods.__getitem__(k);
 mths[k] = mth; 
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
	}
 var bss = null; 
	if (pyjslib.bool(bases)) {
bss = bases.l;
	}
 return pyjs_type(clsname, bss, mths); 
};
pyjslib.type.__name__ = 'type';

pyjslib.type.__bind_type__ = 0;
pyjslib.type.__args__ = [null,null,'clsname', 'bases', 'methods'];
pyjslib.pow = function(x, y, z) {
	if ($pyjs.options.arg_count && (arguments.length < 2 || arguments.length > 3)) pyjs__exception_func_param(arguments.callee.__name__, 2, 3, arguments.length);
	if (typeof z == 'undefined') z=null;
	var p;
	p = null;
p = Math.pow(x, y);
	if (pyjslib.bool((z === null))) {
		return pyjslib.float_(p);
	}
	return pyjslib.float_(p % z);
};
pyjslib.pow.__name__ = 'pow';

pyjslib.pow.__bind_type__ = 0;
pyjslib.pow.__args__ = [null,null,'x', 'y', 'z'];
pyjslib.hex = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
	var r;
	if (pyjslib.bool(!pyjslib.eq(pyjslib.int_(x), x))) {
		throw (pyjslib.TypeError(String('hex() argument can\x27t be converted to hex')));
	}
	r = null;
r = '0x'+x.toString(16);
	return pyjslib.str(r);
};
pyjslib.hex.__name__ = 'hex';

pyjslib.hex.__bind_type__ = 0;
pyjslib.hex.__args__ = [null,null,'x'];
pyjslib.oct = function(x) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
	var r;
	if (pyjslib.bool(!pyjslib.eq(pyjslib.int_(x), x))) {
		throw (pyjslib.TypeError(String('oct() argument can\x27t be converted to oct')));
	}
	r = null;
r = '0'+x.toString(8);
	return pyjslib.str(r);
};
pyjslib.oct.__name__ = 'oct';

pyjslib.oct.__bind_type__ = 0;
pyjslib.oct.__args__ = [null,null,'x'];
pyjslib.round = function(x, n) {
	if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
	if (typeof n == 'undefined') n=0;
	var r;
	n = pyjslib.pow(10, n);
	r = null;
r = Math.round(n*x)/n;
	return pyjslib.float_(r);
};
pyjslib.round.__name__ = 'round';

pyjslib.round.__bind_type__ = 0;
pyjslib.round.__args__ = [null,null,'x', 'n'];
pyjslib.divmod = function(x, y) {
	if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
	var f;
	if (pyjslib.bool((pyjslib.eq(pyjslib.int_(x), x)) && (pyjslib.eq(pyjslib.int_(y), y)))) {
		return new pyjslib.Tuple([pyjslib.int_( ( x / y ) ), pyjslib.int_(x % y)]);
	}
	f = null;
f = Math.floor(x / y);
	f = pyjslib.float_(f);
	return new pyjslib.Tuple([f,  ( x -  ( f * y )  ) ]);
};
pyjslib.divmod.__name__ = 'divmod';

pyjslib.divmod.__bind_type__ = 0;
pyjslib.divmod.__args__ = [null,null,'x', 'y'];
pyjslib.all = function(iterable) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
	var element;
	var __element = iterable.__iter__();
	try {
		while (true) {
			var element = __element.next();
			
			if (pyjslib.bool(!(element))) {
				return false;
			}
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	return true;
};
pyjslib.all.__name__ = 'all';

pyjslib.all.__bind_type__ = 0;
pyjslib.all.__args__ = [null,null,'iterable'];
pyjslib.any = function(iterable) {
	if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
	var element;
	var __element = iterable.__iter__();
	try {
		while (true) {
			var element = __element.next();
			
			if (pyjslib.bool(element)) {
				return true;
			}
		}
	} catch (e) {
		if (e.__name__ != 'StopIteration') {
			throw e;
		}
	}
	return false;
};
pyjslib.any.__name__ = 'any';

pyjslib.any.__bind_type__ = 0;
pyjslib.any.__args__ = [null,null,'iterable'];
pyjslib.init();
pyjslib.__import__(['sys'], 'sys', 'pyjslib');
pyjslib.sys = $pyjs.__modules__.sys;
return this;
}; /* end pyjslib */
$pyjs.modules_hash['pyjslib'] = $pyjs.loaded_modules['pyjslib'];


 /* end module: pyjslib */


/*
PYJS_DEPS: ['sys']
*/


/* start module: JSONParser */
var JSONParser = $pyjs.loaded_modules["JSONParser"] = function (__mod_name__) {
if(JSONParser.__was_initialized__) return JSONParser;
JSONParser.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'JSONParser';
var __name__ = JSONParser.__name__ = __mod_name__;
try {
	pyjslib.__import__(['math'], 'math', 'JSONParser');
	JSONParser.math = $pyjs.__modules__.math;
	JSONParser.JSONParser = (function(){
		var cls_instance = pyjs__class_instance('JSONParser');
		var cls_definition = new Object();
		cls_definition.__md5__ = '4b9e8143a77786ff25cd5c05fbd81e5b';
		cls_definition.decode = pyjs__bind_method(cls_instance, 'decode', function(str) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				str = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}

			return self.jsObjectToPy(self.parseJSON(str));
		}
	, 1, [null,null,'self', 'str']);
		cls_definition.decodeAsObject = pyjs__bind_method(cls_instance, 'decodeAsObject', function(str) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				str = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}

			return self.jsObjectToPyObject(self.parseJSON(str));
		}
	, 1, [null,null,'self', 'str']);
		cls_definition.encode = pyjs__bind_method(cls_instance, 'encode', function(obj) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				obj = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}

			return self.toJSONString(obj);
		}
	, 1, [null,null,'self', 'obj']);
		cls_definition.jsObjectToPy = pyjs__bind_method(cls_instance, 'jsObjectToPy', function(obj) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				obj = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}


        if (pyjslib.isArray(obj)) {
            for (var i in obj) obj[i] = this.jsObjectToPy(obj[i]);
            obj=new pyjslib.List(obj);
            }
        else if (pyjslib.isObject(obj)) {
            for (var i in obj) obj[i]=this.jsObjectToPy(obj[i]);
            obj=new pyjslib.Dict(obj);
            }
        
        return obj;
        
		}
	, 1, [null,null,'self', 'obj']);
		cls_definition.jsObjectToPyObject = pyjs__bind_method(cls_instance, 'jsObjectToPyObject', function(obj) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				obj = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}


        if (pyjslib.isArray(obj)) {
            for (var i in obj) obj[i] = this.jsObjectToPyObject(obj[i]);
            obj=new pyjslib.List(obj);
            }
        else if (pyjslib.isObject(obj)) {
            if (obj["__jsonclass__"]) {
                var class_name = obj["__jsonclass__"][0];
                delete obj["__jsonclass__"];
                obj = this.jsObjectToPyObject(obj);
                
                obj = $pyjs_kwargs_call(null, eval(class_name), null, obj, [{}]);
                }
            else {
                for (var i in obj) obj[i]=this.jsObjectToPyObject(obj[i]);
                obj=new pyjslib.Dict(obj);
                }       
            }
        
        return obj;
        
		}
	, 1, [null,null,'self', 'obj']);
		cls_definition.toJSONString = pyjs__bind_method(cls_instance, 'toJSONString', function(obj) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				obj = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}


   var m = {
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        s = {
            array: function (x) {
                var a = ['['], b, f, i, l = x.length, v;
                for (i = 0; i < l; i += 1) {
                    v = x[i];
                    f = s[typeof v];
                    if (f) {
                        v = f(v);
                        if (typeof v == 'string') {
                            if (b) {
                                a[a.length] = ',';
                            }
                            a[a.length] = v;
                            b = true;
                        }
                    }
                }
                a[a.length] = ']';
                return a.join('');
            },
            'boolean': function (x) {
                return String(x);
            },
            'undefined':function (x) {
               return "null";
            },
            'null': function (x) {
                return "null";
            },
            number: function (x) {
                return isFinite(x) ? String(x) : 'null';
            },
            object: function (x) {
                if (x) {
                    if (x.__number__) {
                        return String(x);
                    }
                    if (x instanceof Array) {
                        return s.array(x);
                    }
                    if (x instanceof pyjslib.List) {
                        return s.array(x.__array);
                    }
                    if (x instanceof pyjslib.Dict) {
                        return s.object(pyjslib.toJSObjects(x));
                    }
                    var a = ['{'], b, f, i, v;
                    for (i in x) {
                        v = x[i];
                        f = s[typeof v];
                        if (f) {
                            v = f(v);
                            if (typeof v == 'string') {
                                if (b) {
                                    a[a.length] = ',';
                                }
                                a.push(s.string(i), ':', v);
                                b = true;
                            }
                        }
                    }
                    a[a.length] = '}';
                    return a.join('');
                }
                return 'null';
            },
            string: function (x) {
                if (/["\\\x00-\x1f]/.test(x)) {
                    x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
                        var c = m[b];
                        if (c) {
                            return c;
                        }
                        c = b.charCodeAt();
                        return '\\u00' +
                            math.floor(c / 16).toString(16) +
                            (c % 16).toString(16);
                    });
                }
                return '"' + x + '"';
            }
        };

        typ = typeof obj;
        f=s[typ];
        return f(obj);
        
		}
	, 1, [null,null,'self', 'obj']);
		cls_definition.parseJSON = pyjs__bind_method(cls_instance, 'parseJSON', function(str) {
			if (this.__is_instance__ === true) {
				var self = this;
				if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length+1);
			} else {
				var self = arguments[0];
				str = arguments[1];
				if ($pyjs.options.arg_is_instance && self.__is_instance__ !== true) pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
				if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			}
			if ($pyjs.options.arg_instance_type) {
				if (self.prototype.__md5__ !== '4b9e8143a77786ff25cd5c05fbd81e5b') {
					if (!pyjslib._isinstance(self, arguments.callee.__class__)) {
						pyjs__exception_func_instance_expected(arguments.callee.__name__, arguments.callee.__class__.__name__, self);
					}
				}
			}


        try {
            return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(str)) &&
                eval('(' + str + ')');
        } catch (e) {
            return false;
        }
        
		}
	, 1, [null,null,'self', 'str']);
		return pyjs__class_function(cls_instance, cls_definition, 
		                            new Array(pyjslib.object));
	})();
	} catch (pyjs_attr_err) {throw pyjslib._errorMapping(pyjs_attr_err);};
	return this;
	}; /* end JSONParser */
	$pyjs.modules_hash['JSONParser'] = $pyjs.loaded_modules['JSONParser'];


	/* end module: JSONParser */


/*
PYJS_DEPS: ['math']
*/


/* start module: webclientController */
var webclientController = $pyjs.loaded_modules["webclientController"] = function (__mod_name__) {
if(webclientController.__was_initialized__) return webclientController;
webclientController.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'webclientController';
var __name__ = webclientController.__name__ = __mod_name__;
try {
	pyjslib.__import__(['JSONParser'], 'JSONParser', 'webclientController');
	webclientController.JSONParser = $pyjs.__modules__.JSONParser;

		function getPosition(obj){
			var topValue= 0,leftValue= 0;
			while(obj){
				leftValue+= obj.offsetLeft;
				topValue+= obj.offsetTop;
				obj= obj.offsetParent;
			}

			return {x : leftValue, y : topValue};
		}

	webclientController.j = jQuery;
	webclientController.doc = document;
	webclientController.qCount = 0;
	webclientController.loadedImages = 0;
	webclientController.loadedFullImages = 0;
	webclientController.preloadStack = String('');
	webclientController.imageUrls = pyjslib.dict();
	webclientController.imgLocation = pyjslib.dict();
	webclientController.imageResultData = pyjslib.dict();
	webclientController.element = function(string) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

		return document.getElementById(string);
	};
	webclientController.element.__name__ = 'element';

	webclientController.element.__bind_type__ = 0;
	webclientController.element.__args__ = [null,null,'string'];
	webclientController.uiIter = function(index, value) {
		if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

		pyjslib.printFunc([index, value], 1);
		return null;
	};
	webclientController.uiIter.__name__ = 'uiIter';

	webclientController.uiIter.__bind_type__ = 0;
	webclientController.uiIter.__args__ = [null,null,'index', 'value'];
	webclientController.getHtmlForFeatheredImage = function(img, stay) {
		if ($pyjs.options.arg_count && (arguments.length < 1 || arguments.length > 2)) pyjs__exception_func_param(arguments.callee.__name__, 1, 2, arguments.length);
		if (typeof stay == 'undefined') stay=false;
		var style,html,fullUrl;
		pyjslib.printFunc([String('entering getHtmlForFeatheredImage')], 1);
		fullUrl = webclientController.imageResultData.__getitem__((img.id===undefined?(function(){throw new TypeError('img.id is undefined');})():(typeof img.id == 'function' && img.__is_instance__?pyjslib.getattr(img, 'id'):img.id))).__getitem__(String('fullUrl'));
		pyjslib.printFunc([ ( pyjs_op_add(String('stay = '), pyjslib.str(stay)) ) ], 1);
		if (pyjslib.bool(pyjslib.eq(stay, true))) {
			style = (img.parentNode.style===undefined?(function(){throw new TypeError('img.parentNode.style is undefined');})():(typeof img.parentNode.style == 'function' && img.parentNode.__is_instance__?pyjslib.getattr(img.parentNode, 'style'):img.parentNode.style));
			html = pyjslib.sprintf(String('\x3Cimg class=\x27edges imask2 ui-resizable makeDraggable\x27 src=\x27%s\x27 style=\x27overflow:hidden\x3B position:absolute\x3B display: inline\x3B height: %s\x3B width: %s\x3B top:%s\x3B left:%s\x3B \x27/\x3E'), new pyjslib.Tuple([fullUrl, (style.height===undefined?(function(){throw new TypeError('style.height is undefined');})():(typeof style.height == 'function' && style.__is_instance__?pyjslib.getattr(style, 'height'):style.height)), (style.width===undefined?(function(){throw new TypeError('style.width is undefined');})():(typeof style.width == 'function' && style.__is_instance__?pyjslib.getattr(style, 'width'):style.width)), (style.top===undefined?(function(){throw new TypeError('style.top is undefined');})():(typeof style.top == 'function' && style.__is_instance__?pyjslib.getattr(style, 'top'):style.top)), (style.left===undefined?(function(){throw new TypeError('style.left is undefined');})():(typeof style.left == 'function' && style.__is_instance__?pyjslib.getattr(style, 'left'):style.left))]));
			if (pyjslib.bool(pyjslib.eq((style.position===undefined?(function(){throw new TypeError('style.position is undefined');})():(typeof style.position == 'function' && style.__is_instance__?pyjslib.getattr(style, 'position'):style.position)), String('relative')))) {
				html = String('');
			}
		}
		else {
			html = pyjslib.sprintf(String('\x3Cimg class=\x27edges imask2 ui-resizable makeDraggable\x27 id=\x27%s\x27 width=\x27100\x27 height=\x2749\x27 src=\x27%s\x27 style=\x27margin: 0px\x3B position: static\x3B display: block\x3B height: %s\x3B width: %s\x3B\x27/\x3E'), new pyjslib.Tuple([(img.id===undefined?(function(){throw new TypeError('img.id is undefined');})():(typeof img.id == 'function' && img.__is_instance__?pyjslib.getattr(img, 'id'):img.id)), fullUrl, String('100%'), String('100%')]));
		}
		return html;
	};
	webclientController.getHtmlForFeatheredImage.__name__ = 'getHtmlForFeatheredImage';

	webclientController.getHtmlForFeatheredImage.__bind_type__ = 0;
	webclientController.getHtmlForFeatheredImage.__args__ = [null,null,'img', 'stay'];
	webclientController.removeFeathering = function(img) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

		pyjslib.printFunc([String('entering removeFeathering')], 1);
		webclientController.j( ( pyjs_op_add(String('#'), (img.id===undefined?(function(){throw new TypeError('img.id is undefined');})():(typeof img.id == 'function' && img.__is_instance__?pyjslib.getattr(img, 'id'):img.id))) ) ).replaceWith(webclientController.getHtmlForFeatheredImage(img));
		return null;
	};
	webclientController.removeFeathering.__name__ = 'removeFeathering';

	webclientController.removeFeathering.__bind_type__ = 0;
	webclientController.removeFeathering.__args__ = [null,null,'img'];
	webclientController.featherImages = function() {
		if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);

		pyjslib.printFunc([String('in featherImages(), running Javascript tryMasking function')], 1);
tryMasking();
	};
	webclientController.featherImages.__name__ = 'featherImages';

	webclientController.featherImages.__bind_type__ = 0;
	webclientController.featherImages.__args__ = [null,null];
	webclientController.makeDraggableEtc = function() {
		if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);
		var resizeStop,dragStop,resize,resizeStart;
		resize = function(event, ui) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

			pyjslib.printFunc([String('resizing')], 1);
			return null;
		};
		resize.__name__ = 'resize';

		resize.__bind_type__ = 0;
		resize.__args__ = [null,null,'event', 'ui'];
		resizeStart = function(event, ui) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			var img;
			img = ui.element.attr(String('firstChild'));
			if (pyjslib.bool(!pyjslib.eq((img.tagName===undefined?(function(){throw new TypeError('img.tagName is undefined');})():(typeof img.tagName == 'function' && img.__is_instance__?pyjslib.getattr(img, 'tagName'):img.tagName)), String('IMG')))) {
				pyjslib.printFunc([String('probably is feathered, removing effect for now')], 1);
				webclientController.removeFeathering(img);
			}
			return null;
		};
		resizeStart.__name__ = 'resizeStart';

		resizeStart.__bind_type__ = 0;
		resizeStart.__args__ = [null,null,'event', 'ui'];
		resizeStop = function(event, ui) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

			pyjslib.printFunc([String('resizing stopped, applying feathering')], 1);
			webclientController.j((event.target===undefined?(function(){throw new TypeError('event.target is undefined');})():(typeof event.target == 'function' && event.__is_instance__?pyjslib.getattr(event, 'target'):event.target))).attr(String('class'), String('makeDraggable edges imask2'));
			webclientController.featherImages();
			return null;
		};
		resizeStop.__name__ = 'resizeStop';

		resizeStop.__bind_type__ = 0;
		resizeStop.__args__ = [null,null,'event', 'ui'];
		dragStop = function(event, ui) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			var mainPos;
			pyjslib.printFunc([String('dragging stopped on'), (event.target.id===undefined?(function(){throw new TypeError('event.target.id is undefined');})():(typeof event.target.id == 'function' && event.target.__is_instance__?pyjslib.getattr(event.target, 'id'):event.target.id))], 1);
			if (pyjslib.bool(pyjslib.eq((event.target.parentNode.id===undefined?(function(){throw new TypeError('event.target.parentNode.id is undefined');})():(typeof event.target.parentNode.id == 'function' && event.target.parentNode.__is_instance__?pyjslib.getattr(event.target.parentNode, 'id'):event.target.parentNode.id)), String('results')))) {
				pyjslib.printFunc([String('need to move image to main area with containment applied')], 1);
				event.target.style.position = String('absolute');
				mainPos = getPosition(webclientController.element(String('main')));
				event.target.style.top =  ( (ui.absolutePosition.top===undefined?(function(){throw new TypeError('ui.absolutePosition.top is undefined');})():(typeof ui.absolutePosition.top == 'function' && ui.absolutePosition.__is_instance__?pyjslib.getattr(ui.absolutePosition, 'top'):ui.absolutePosition.top)) - (mainPos.y===undefined?(function(){throw new TypeError('mainPos.y is undefined');})():(typeof mainPos.y == 'function' && mainPos.__is_instance__?pyjslib.getattr(mainPos, 'y'):mainPos.y)) ) ;
				event.target.style.left =  ( (ui.absolutePosition.left===undefined?(function(){throw new TypeError('ui.absolutePosition.left is undefined');})():(typeof ui.absolutePosition.left == 'function' && ui.absolutePosition.__is_instance__?pyjslib.getattr(ui.absolutePosition, 'left'):ui.absolutePosition.left)) - (mainPos.x===undefined?(function(){throw new TypeError('mainPos.x is undefined');})():(typeof mainPos.x == 'function' && mainPos.__is_instance__?pyjslib.getattr(mainPos, 'x'):mainPos.x)) ) ;
				pyjslib.printFunc([(ui.absolutePosition.top===undefined?(function(){throw new TypeError('ui.absolutePosition.top is undefined');})():(typeof ui.absolutePosition.top == 'function' && ui.absolutePosition.__is_instance__?pyjslib.getattr(ui.absolutePosition, 'top'):ui.absolutePosition.top)), (ui.absolutePosition.left===undefined?(function(){throw new TypeError('ui.absolutePosition.left is undefined');})():(typeof ui.absolutePosition.left == 'function' && ui.absolutePosition.__is_instance__?pyjslib.getattr(ui.absolutePosition, 'left'):ui.absolutePosition.left))], 1);
				pyjslib.printFunc([ ( (ui.absolutePosition.top===undefined?(function(){throw new TypeError('ui.absolutePosition.top is undefined');})():(typeof ui.absolutePosition.top == 'function' && ui.absolutePosition.__is_instance__?pyjslib.getattr(ui.absolutePosition, 'top'):ui.absolutePosition.top)) - (mainPos.y===undefined?(function(){throw new TypeError('mainPos.y is undefined');})():(typeof mainPos.y == 'function' && mainPos.__is_instance__?pyjslib.getattr(mainPos, 'y'):mainPos.y)) ) ,  ( (ui.absolutePosition.left===undefined?(function(){throw new TypeError('ui.absolutePosition.left is undefined');})():(typeof ui.absolutePosition.left == 'function' && ui.absolutePosition.__is_instance__?pyjslib.getattr(ui.absolutePosition, 'left'):ui.absolutePosition.left)) - (mainPos.x===undefined?(function(){throw new TypeError('mainPos.x is undefined');})():(typeof mainPos.x == 'function' && mainPos.__is_instance__?pyjslib.getattr(mainPos, 'x'):mainPos.x)) ) ], 1);
				webclientController.j(String('#main')).append((event.target===undefined?(function(){throw new TypeError('event.target is undefined');})():(typeof event.target == 'function' && event.__is_instance__?pyjslib.getattr(event, 'target'):event.target)));
				webclientController.j((event.target===undefined?(function(){throw new TypeError('event.target is undefined');})():(typeof event.target == 'function' && event.__is_instance__?pyjslib.getattr(event, 'target'):event.target))).draggable(String('option'), String('containment'), String('parent'));
			}
			return null;
		};
		dragStop.__name__ = 'dragStop';

		dragStop.__bind_type__ = 0;
		dragStop.__args__ = [null,null,'event', 'ui'];
		webclientController.j(String('#searchPanel \x3E #results \x3E .makeDraggable')).resizable({aspectRatio:true, resize:resizeStart, stop:resizeStop}).parent(String('.ui-wrapper')).draggable({stop:dragStop});
		return null;
	};
	webclientController.makeDraggableEtc.__name__ = 'makeDraggableEtc';

	webclientController.makeDraggableEtc.__bind_type__ = 0;
	webclientController.makeDraggableEtc.__args__ = [null,null];
	webclientController.fullImageLoaded = function(loadedImage) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		var safeID;
		webclientController.loadedFullImages =  ( pyjs_op_add(webclientController.loadedFullImages, 1) ) ;
		pyjslib.printFunc([ ( pyjs_op_add( ( pyjs_op_add(webclientController.loadedFullImages, String(' full image/s has loaded out of ')) ) , pyjslib.str(pyjslib.len(webclientController.imageResultData))) ) ], 1);
		safeID = (loadedImage.alt===undefined?(function(){throw new TypeError('loadedImage.alt is undefined');})():(typeof loadedImage.alt == 'function' && loadedImage.__is_instance__?pyjslib.getattr(loadedImage, 'alt'):loadedImage.alt));
		return null;
	};
	webclientController.fullImageLoaded.__name__ = 'fullImageLoaded';

	webclientController.fullImageLoaded.__bind_type__ = 0;
	webclientController.fullImageLoaded.__args__ = [null,null,'loadedImage'];
	webclientController.fullImageLoadError = function(thumbID, failedImageObject) {
		if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
		var obj;
		pyjslib.printFunc([(failedImageObject.src===undefined?(function(){throw new TypeError('failedImageObject.src is undefined');})():(typeof failedImageObject.src == 'function' && failedImageObject.__is_instance__?pyjslib.getattr(failedImageObject, 'src'):failedImageObject.src)), thumbID, String('failed to load and will be removed')], 1);
    webclientController.imageResultData.__delitem__(thumbID);
		obj = webclientController.j( ( pyjs_op_add(String('#'), thumbID) ) );
		if (pyjslib.bool(pyjslib.eq((function(){var pyjs__testval=obj.parent().get(0).className;return (pyjs__testval===undefined?(function(){throw new TypeError('obj.parent().get(0).className is undefined');})():pyjs__testval);})(), String('ui-wrapper ui-draggable')))) {
			obj.parent().replaceWith(String(''));
		}
		return false;
	};
	webclientController.fullImageLoadError.__name__ = 'fullImageLoadError';

	webclientController.fullImageLoadError.__bind_type__ = 0;
	webclientController.fullImageLoadError.__args__ = [null,null,'thumbID', 'failedImageObject'];
	webclientController.thumbLoaded = function(id, loadedImage) {
		if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

		if (pyjslib.bool(pyjslib.eq(webclientController.imageResultData.__getitem__(id).__getitem__(String('thumbLoaded')), false))) {
			pyjslib.printFunc([String('thumb for'), id, String('has loaded')], 1);
			webclientController.loadedImages =  ( pyjs_op_add(webclientController.loadedImages, 1) ) ;
			webclientController.imageResultData.__getitem__(id).__setitem__(String('thumbLoaded'), true);
			webclientController.j(loadedImage).attr(String('class'), String('makeDraggable edges imask2'));
			webclientController.featherImages();
			webclientController.imageResultData.__getitem__(id).__setitem__(String('feathered'), true);
			if (pyjslib.bool((pyjslib.cmp(webclientController.loadedImages,  ( pyjslib.len(webclientController.imageResultData) - 1 ) ) == 1))) {
				if (pyjslib.bool((pyjslib.cmp(pyjslib.len(webclientController.preloadStack), 0) == 1))) {
					webclientController.j(document).append(webclientController.preloadStack);
					webclientController.preloadStack = String('');
					pyjslib.printFunc([String('preloading full images')], 1);
				}
			}
		}
		return null;
	};
	webclientController.thumbLoaded.__name__ = 'thumbLoaded';

	webclientController.thumbLoaded.__bind_type__ = 0;
	webclientController.thumbLoaded.__args__ = [null,null,'id', 'loadedImage'];
	webclientController.doImageSearch = function(term) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		var gotImages,url;
		pyjslib.printFunc([String('searching for'), term], 1);
		webclientController.qCount =  ( pyjs_op_add(webclientController.qCount, 80) ) ;
		gotImages = function(results, h) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			var thumbUrl,width,safeID,height,imageHtml,html,result,fullUrl;
			imageHtml = String('');
			results = webclientController.JSONParser.JSONParser().decode(results);
			var __result = results.__iter__();
			try {
				while (true) {
					var result = __result.next();
					
					safeID = results.__getitem__(result).__getitem__(String('safeID'));
					thumbUrl = results.__getitem__(result).__getitem__(String('thumbUrl'));
					fullUrl = results.__getitem__(result).__getitem__(String('fullUrl'));
					width = results.__getitem__(result).__getitem__(String('width'));
					height = results.__getitem__(result).__getitem__(String('height'));
					webclientController.imageResultData.__setitem__(safeID, new pyjslib.Dict([[String('thumbUrl'), webclientController.url], [String('fullUrl'), fullUrl], [String('safeID'), safeID], [String('width'), width], [String('height'), height]]));
					webclientController.imageResultData.__getitem__(safeID).__setitem__(String('thumbLoaded'), false);
					imageHtml =  ( pyjs_op_add(imageHtml, pyjslib.sprintf(String('\x3Cimg class=\x27makeDraggable\x27 id=\x27%s\x27 src=\x27%s\x27 width=\x27%s\x27 height=\x27%s\x27 onLoad=\x27webclientController.thumbLoaded(this.id,this)\x27/\x3E '), new pyjslib.Tuple([safeID, thumbUrl, width, height]))) ) ;
				}
			} catch (e) {
				if (e.__name__ != 'StopIteration') {
					throw e;
				}
			}
			html =  ( pyjs_op_add( ( pyjs_op_add(String('\x3Cdiv class=\x27col\x27 id=\x27results\x27\x3E'), imageHtml) ) , String('\x3C/div\x3E')) ) ;
			webclientController.preloadStack = String('');
			var __result = results.__iter__();
			try {
				while (true) {
					var result = __result.next();
					
					webclientController.preloadStack =  ( pyjs_op_add(webclientController.preloadStack, pyjslib.sprintf(String('\x3Cimg style=\x27visibility:collapse\x3B\x27 src=\x27%s\x27 onLoad=\x27webclientController.fullImageLoaded(this)\x27 onError=\x27webclientController.fullImageLoadError(this.alt, this)\x27 alt=\x27%s\x27 /\x3E '), new pyjslib.Tuple([results.__getitem__(result).__getitem__(String('fullUrl')), results.__getitem__(result).__getitem__(String('safeID'))]))) ) ;
				}
			} catch (e) {
				if (e.__name__ != 'StopIteration') {
					throw e;
				}
			}
			webclientController.j(String('#results')).replaceWith(html);
			webclientController.makeDraggableEtc();
			return null;
		};
		gotImages.__name__ = 'gotImages';

		gotImages.__bind_type__ = 0;
		gotImages.__args__ = [null,null,'results', 'h'];
		url =  ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add(String('search?term='), encodeURI(term)) ) , String('\x26qCount=')) ) , webclientController.qCount) ) ;
		webclientController.j.ajax({url: url, success:gotImages});
		return null;
	};
	webclientController.doImageSearch.__name__ = 'doImageSearch';

	webclientController.doImageSearch.__bind_type__ = 0;
	webclientController.doImageSearch.__args__ = [null,null,'term'];
	webclientController.auto = function() {
		if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);
		var url,gotImagesFromFreeText,terms;
		webclientController.qCount =  ( pyjs_op_add(webclientController.qCount, 5000) ) ;
		gotImagesFromFreeText = function(html, status) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

			html =  ( pyjs_op_add( ( pyjs_op_add(String('\x3Cdiv class=\x27col\x27 id=\x27results\x27\x3E'), html) ) , String('\x3C/div\x3E')) ) ;
			webclientController.j(String('#results')).replaceWith(html);
			webclientController.makeDraggableEtc();
			return null;
		};
		gotImagesFromFreeText.__name__ = 'gotImagesFromFreeText';

		gotImagesFromFreeText.__bind_type__ = 0;
		gotImagesFromFreeText.__args__ = [null,null,'html', 'status'];
		terms = webclientController.j(String('#allTogether')).val();
		url =  ( pyjs_op_add( ( pyjs_op_add( ( pyjs_op_add(String('free?term='), escape(terms)) ) , String('\x26qCount=')) ) , webclientController.qCount) ) ;
		webclientController.j.ajax({url: url, success:gotImagesFromFreeText});
		return null;
	};
	webclientController.auto.__name__ = 'auto';

	webclientController.auto.__bind_type__ = 0;
	webclientController.auto.__args__ = [null,null];
	webclientController.save = function() {
		if ($pyjs.options.arg_count && arguments.length != 0) pyjs__exception_func_param(arguments.callee.__name__, 0, 0, arguments.length);
		var featheredObject,gotLink;
		pyjslib.printFunc([String('this is where we save')], 1);
		webclientController.html = String('');
		featheredObject = function(index, value) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			var part;
			part = pyjs_kwargs_call(webclientController, 'getHtmlForFeatheredImage', null, null, [{stay:true}, value]);
			webclientController.html =  ( pyjs_op_add(webclientController.html, part) ) ;
			return null;
		};
		featheredObject.__name__ = 'featheredObject';

		featheredObject.__bind_type__ = 0;
		featheredObject.__args__ = [null,null,'index', 'value'];
		webclientController.j.each(webclientController.j(String('#main canvas')), featheredObject);
		pyjslib.printFunc([webclientController.html], 1);
		gotLink = function(result, status) {
			if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);
			var url;
			url = pyjslib.str((webclientController.doc.location===undefined?(function(){throw new TypeError('webclientController.doc.location is undefined');})():(typeof webclientController.doc.location == 'function' && webclientController.doc.__is_instance__?pyjslib.getattr(webclientController.doc, 'location'):webclientController.doc.location)));
			if (pyjslib.bool((url.startswith(String('http://localhost:8001'))) || (url.startswith(String('http://127.0.0.1:8001'))))) {
				result = result.replace(String('thoughttrail.com/lifemap/'), String('127.0.0.1:8001/'));
			}
			webclientController.j(String('#savedUrl')).replaceWith(result);
			return null;
		};
		gotLink.__name__ = 'gotLink';

		gotLink.__bind_type__ = 0;
		gotLink.__args__ = [null,null,'result', 'status'];
		webclientController.j.post( ( pyjs_op_add(String('save?output='), escape(webclientController.html)) ) , gotLink);
		return null;
	};
	webclientController.save.__name__ = 'save';

	webclientController.save.__bind_type__ = 0;
	webclientController.save.__args__ = [null,null];
	webclientController.myStart = function(a) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);

		webclientController.doImageSearch(String('strawberries'));
		return null;
	};
	webclientController.myStart.__name__ = 'myStart';

	webclientController.myStart.__bind_type__ = 0;
	webclientController.myStart.__args__ = [null,null,'a'];
	webclientController.j(window).load(webclientController.myStart(webclientController.a));
	} catch (pyjs_attr_err) {throw pyjslib._errorMapping(pyjs_attr_err);};
	return this;
	}; /* end webclientController */
	$pyjs.modules_hash['webclientController'] = $pyjs.loaded_modules['webclientController'];


	/* end module: webclientController */


/*
PYJS_DEPS: ['JSONParser']
*/


/* start module: math */
var math = $pyjs.loaded_modules["math"] = function (__mod_name__) {
if(math.__was_initialized__) return math;
math.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'math';
var __name__ = math.__name__ = __mod_name__;
try {

math.ceil = Math.ceil;
math.fabs = Math.abs;
math.floor = Math.floor;
math.exp = Math.exp;
math.log = Math.log;
math.pow = Math.pow;
math.sqrt = Math.sqrt;
math.cos = Math.cos;
math.sin = Math.sin;
math.tan = Math.tan;
math.acos = Math.acos;
math.asin = Math.asin;
math.atan = Math.atan;
math.atan2 = Math.atan2;
math.pi = Math.PI;
math.e = Math.E;

	math.__log2__ = math.log(2);
	math.fsum = function(x) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		var i,xx,sum;
		xx = function(){
var listcomp000001 = pyjslib.List();
		var __temp_i = pyjslib.enumerate(x).__iter__();
		try {
			while (true) {
				var temp_i = __temp_i.next();
						var i = temp_i.__getitem__(0);		var v = temp_i.__getitem__(1);
				listcomp000001.append(new pyjslib.Tuple([math.fabs(v), i]));
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
return listcomp000001;}();
		xx.sort();
		sum = 0;
		var __i = xx.__iter__();
		try {
			while (true) {
				var i = __i.next();
				
				sum += x.__getitem__(i.__getitem__(1));
			}
		} catch (e) {
			if (e.__name__ != 'StopIteration') {
				throw e;
			}
		}
		return sum;
	};
	math.fsum.__name__ = 'fsum';

	math.fsum.__bind_type__ = 0;
	math.fsum.__args__ = [null,null,'x'];
	math.frexp = function(x) {
		if ($pyjs.options.arg_count && arguments.length != 1) pyjs__exception_func_param(arguments.callee.__name__, 1, 1, arguments.length);
		var e,m;
		if (pyjslib.bool(pyjslib.eq(x, 0))) {
			return new pyjslib.Tuple([0.0, 0]);
		}
		e =  ( pyjs_op_add(pyjslib.int_( ( math.log(pyjslib.abs(x)) / math.__log2__ ) ), 1) ) ;
		m =  ( x / Math.pow(2.0,e) ) ;
		return new pyjslib.Tuple([m, e]);
	};
	math.frexp.__name__ = 'frexp';

	math.frexp.__bind_type__ = 0;
	math.frexp.__args__ = [null,null,'x'];
	math.ldexp = function(x, i) {
		if ($pyjs.options.arg_count && arguments.length != 2) pyjs__exception_func_param(arguments.callee.__name__, 2, 2, arguments.length);

		return  ( x * Math.pow(2,i) ) ;
	};
	math.ldexp.__name__ = 'ldexp';

	math.ldexp.__bind_type__ = 0;
	math.ldexp.__args__ = [null,null,'x', 'i'];
	} catch (pyjs_attr_err) {throw pyjslib._errorMapping(pyjs_attr_err);};
	return this;
	}; /* end math */
	$pyjs.modules_hash['math'] = $pyjs.loaded_modules['math'];


	/* end module: math */




/* start module: sets */
var sets = $pyjs.loaded_modules["sets"] = function (__mod_name__) {
if(sets.__was_initialized__) return sets;
sets.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'sets';
var __name__ = sets.__name__ = __mod_name__;
try {
	} catch (pyjs_attr_err) {throw pyjslib._errorMapping(pyjs_attr_err);};
	return this;
	}; /* end sets */
	$pyjs.modules_hash['sets'] = $pyjs.loaded_modules['sets'];


	/* end module: sets */




/* start module: commonFunc */
var commonFunc = $pyjs.loaded_modules["commonFunc"] = function (__mod_name__) {
if(commonFunc.__was_initialized__) return commonFunc;
commonFunc.__was_initialized__ = true;
if (__mod_name__ == null) __mod_name__ = 'commonFunc';
var __name__ = commonFunc.__name__ = __mod_name__;
try {
	} catch (pyjs_attr_err) {throw pyjslib._errorMapping(pyjs_attr_err);};
	return this;
	}; /* end commonFunc */
	$pyjs.modules_hash['commonFunc'] = $pyjs.loaded_modules['commonFunc'];


	/* end module: commonFunc */




/* initialize library */
pyjslib("pyjslib");

/* initialize application */
webclientController("webclientController");


