def __init__(self, filename=None, create=False, random_seed=None, last_played=None, readonly=False, dat_name='level'):
        """
        Load an Alpha level from the given filename. It can point to either
        a level.dat or a folder containing one. If create is True, it will
        also create the world using the random_seed and last_played arguments.
        If they are none, a random 64-bit seed will be selected for RandomSeed
        and long(time.time() * 1000) will be used for LastPlayed.

        If you try to create an existing world, its level.dat will be replaced.
        """

        self.dat_name = dat_name

        self.Length = 0
        self.Width = 0
        self.Height = 256

        self.playerTagCache = {}
        self.players = []
        assert not (create and readonly)

        self.lockAcquireFuncs = []
        self.lockLoseFuncs = []
        self.initTime = -1

        if os.path.basename(filename) in ("%s.dat" % dat_name, "%s.dat_old" % dat_name):
            filename = os.path.dirname(filename)

        if not os.path.exists(filename):
            if not create:
                raise IOError('File not found')

            os.mkdir(filename)

        if not os.path.isdir(filename):
            raise IOError('File is not a Minecraft Alpha world')

        self.worldFolder = AnvilWorldFolder(filename)
        self.filename = self.worldFolder.getFilePath("%s.dat" % dat_name)
        self.readonly = readonly
        if not readonly:
            self.acquireSessionLock()
            workFolderPath = self.worldFolder.getFolderPath("##MCEDIT.TEMP##")
            workFolderPath2 = self.worldFolder.getFolderPath("##MCEDIT.TEMP2##")
            if os.path.exists(workFolderPath):
                # xxxxxxx Opening a world a second time deletes the first world's work folder and crashes when the first
                # world tries to read a modified chunk from the work folder. This mainly happens when importing a world
                # into itself after modifying it.
                shutil.rmtree(workFolderPath, True)
            if os.path.exists(workFolderPath2):
                shutil.rmtree(workFolderPath2, True)

            self.unsavedWorkFolder = AnvilWorldFolder(workFolderPath)
            self.fileEditsFolder = AnvilWorldFolder(workFolderPath2)

            self.editFileNumber = 1

        # maps (cx, cz) pairs to AnvilChunk
        self._loadedChunks = weakref.WeakValueDictionary()

        # maps (cx, cz) pairs to AnvilChunkData
        self._loadedChunkData = {}
        self.recentChunks = collections.deque(maxlen=20)

        self.chunksNeedingLighting = set()
        self._allChunks = None
        self.dimensions = {}

        self.loadLevelDat(create, random_seed, last_played)

        if dat_name == 'level':
            assert self.version == self.VERSION_ANVIL, "Pre-Anvil world formats are not supported (for now)"

            if not readonly:
                if os.path.exists(self.worldFolder.getFolderPath("players")) and os.listdir(
                        self.worldFolder.getFolderPath("players")) != []:
                    self.playersFolder = self.worldFolder.getFolderPath("players")
                    self.oldPlayerFolderFormat = True
                if os.path.exists(self.worldFolder.getFolderPath("playerdata")):
                    self.playersFolder = self.worldFolder.getFolderPath("playerdata")
                    self.oldPlayerFolderFormat = False
                self.players = [x[:-4] for x in os.listdir(self.playersFolder) if x.endswith(".dat")]
                for player in self.players:
                    try:
                        UUID(player, version=4)
                    except ValueError:
                        try:
                            print "{0} does not seem to be in a valid UUID format".format(player)
                        except UnicodeEncode:
                            try:
                                print u"{0} does not seem to be in a valid UUID format".format(player)
                            except UnicodeError:
                                print "{0} does not seem to be in a valid UUID format".format(repr(player))
                        self.players.remove(player)
                if "Player" in self.root_tag["Data"]:
                    self.players.append("Player")
    
                self.preloadDimensions()

        Load an Alpha level from the given filename. It can point to either
        a level.dat or a folder containing one. If create is True, it will
        also create the world using the random_seed and last_played arguments.
        If they are none, a random 64-bit seed will be selected for RandomSeed
        and long(time.time() * 1000) will be used for LastPlayed.

        If you try to create an existing world, its level.dat will be replaced.
        
pymclevel/infiniteworld.py