Preparing and creating script.

def creator(entry, config):
        """Preparing and creating script."""
        script = render(config.script, model=config.model, env=config.env, item=config.item)

        temp = tempfile.NamedTemporaryFile(prefix="script-", suffix=".py", mode='w+t', delete=False)
        temp.writelines(script)
        temp.close()

        language = 'python' if 'type' not in entry else entry['type']
        template_file = os.path.join(os.path.dirname(__file__), 'templates/%s-script.sh.j2' % language)

        with open(template_file) as handle:
            template = handle.read()
            config.script = render(template, script=temp.name)

        return Script(config)