def write_binary(self, data, ensure=False):
        """Write binary data into path.   If ensure is True create
        missing parent directories.
        """
        if ensure:
            self.dirpath().ensure(dir=1)
        with self.open("wb") as f:
            f.write(data)
Write binary data into path.   If ensure is True create
        missing parent directories.
        
src/_pytest/_py/path.py