def __init__(self, filename, fd=None):
        """ Takes either a filename to open or a file object (including StringIO) to parse """
        self.filename = filename
        if not fd:
            self.fd = open(filename, 'r')
        else:
            self.fd = fd
        data = self.fd.read(4)
        assert data in ("CON ", "PIRS", "LIVE"), "STFS Magic not found"

        self.table_spacing = [(0xAB, 0x718F, 0xFE7DA), #The distance in blocks between tables
                              (0xAC, 0x723A, 0xFD00B)] #For when tables are 1 block and when they are 2 blocks
        self.magic = data
        self.fd.seek(0)
        self.data = self.fd.read(0x971A) # Header data (this is only a member during testing)
        self.parse_header(self.data)
        self.parse_filetable()
dataset/ETHPy150Open arkem/py360/py360/stfs.py/STFS.__init__/original