def generate(modname):

	# check for valid name
	if modname.lower() in pydoc.Helper.keywords.keys():
		raise PyscaleError('%s is a Python keyword.' % repr(modname.lower()))

	# go to project root
	root = find_project()
	if root != False:
		os.chdir(root)
	else:
		raise PyscaleError('Pyscale project not found (missing Cakefile?)')


	# create folder
	folder = 'app/%s' % modname
	if osp.isdir(folder):
		puts(fore.yellow(' exists ') + folder)
	else:
		puts(fore.green('  mkdir ') + folder)
		os.makedirs(folder)

	
	# create file
	modfile = 'app/%s/main' % modname
	tplfile = osp.join(pyscale.__path__[0], 'files', 'module')

	if osp.exists(modfile):
		raise PyscaleError('Module already exists. Aborting...')
	else:
		with open(tplfile) as f:
			tpl = jinja2.Template(f.read())
			tpl = tpl.render(module=modname.title())

		puts(fore.green(' create ') + modfile)
		with open(modfile, 'w') as f:
			f.write(tpl)
dp
dataset/ETHPy150Open alexcepoi/pyscale/pyscale/tools/generators.py/generate--crossover with--dataset/ETHPy150Open algorhythms/LintCode/Backpack.py/Solution_MLE.backPack