def METHOD_NAME(buffer: BinaryIO, **kwargs: Any) -> Any:
    try:
        import scipy.io as sio
    except ImportError as error:
        raise ModuleNotFoundError("Package `scipy` is required to be installed to read .mat files.") from error
    data = sio.loadmat(buffer, **kwargs)
    buffer.close()
    return data