def download(self, temp_ver, store_metadata=True):
dest = self._prefixed(temp_ver.name)<EOL>temp_dest = '<STR_LIT>' % dest<EOL>with utils.LockFile(dest + '<STR_LIT>'):<EOL><INDENT>if os.path.exists(dest):<EOL><INDENT>return<EOL><DEDENT>temp_ver.download(temp_dest)<EOL>if store_metadata:<EOL><INDENT>with open('<STR_LIT>' % dest, '<STR_LIT:w>') as f:<EOL><INDENT>utils.json_dump(temp_ver.get_metadata(), f)<EOL><DEDENT><DEDENT>sha1 = utils.get_hash(temp_dest)<EOL>if temp_ver.get_hash() != sha1:<EOL><INDENT>raise RuntimeError(<EOL>'<STR_LIT>' % (<EOL>temp_ver.name,<EOL>sha1,<EOL>)<EOL>)<EOL><DEDENT>with open('<STR_LIT>' % dest, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(sha1)<EOL><DEDENT>with log_utils.LogTask('<STR_LIT>', logger=LOGGER):<EOL><INDENT>result = utils.run_command(<EOL>[<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>temp_dest,<EOL>dest,<EOL>],<EOL>)<EOL>os.unlink(temp_dest)<EOL>if result:<EOL><INDENT>raise RuntimeError(result.err)<EOL><DEDENT><DEDENT><DEDENT>
Retrieve the given template version

Args:
    temp_ver (TemplateVersion): template version to retrieve
    store_metadata (bool): If set to ``False``, will not refresh the
        local metadata with the retrieved one

Returns:
    None