/**
* Internal fsync implementation.
*/
private static void fsync(PyObject fd, boolean metadata) {
RawIOBase rawIO = FileDescriptors.get(fd);
rawIO.checkClosed();
Channel channel = rawIO.getChannel();
if (!(channel instanceof FileChannel)) {
throw Py.OSError(Errno.EINVAL);
}