def read_stream(stream, extension):
    cls = EXTENSION_TO_CLASS.get(extension)
    if not cls:
        raise ValueError('Unsupported file extension "%s"' % extension)
    file = cls(stream)
    file.initialize()
    return file
dataset/ETHPy150Open blixt/py-starbound/starbound/helpers.py/read_stream/original