def gameVersionNumber(self):  # Should return the version number that the world is from (eg "1.12.2"...)
        """Returns the version number the world was last opened in or 'Unknown'"""
        if self.root_tag and not hasattr(self, '_gameVersionNumber'):
            self._gameVersionNumber = 'Unknown'
            if self.gamePlatform == "PE":
                if 'Data' in self.root_tag and isinstance(self.root_tag['Data'], nbt.TAG_Compound):
                    if 'lastOpenedWithVersion' in self.root_tag['Data'] and isinstance(self.root_tag['Data']['lastOpenedWithVersion'], nbt.TAG_List):
                        self._gameVersionNumber = '.'.join([str(num.value) for num in self.root_tag['Data']['lastOpenedWithVersion']])
                    else:
                        self._gameVersionNumber = self.root_tag['Data']['lastOpenedWithVersion']
            elif self.gamePlatform == "Java":
                if 'Data' in self.root_tag and isinstance(self.root_tag['Data'], nbt.TAG_Compound):
                    # We're opening a world.
                    if 'Version' in self.root_tag['Data']:
                        if 'Name' in self.root_tag['Data']['Version']:
                            self._gameVersionNumber = self.root_tag['Data']['Version']['Name'].value
                elif self.root_tag.name:
                    self._gameVersion = self.root_tag.name
        return self._gameVersionNumber
Returns the version number the world was last opened in or 'Unknown'
pymclevel/level.py