As per the other answers, the master is driving the line high. Nothing should drive the line high in I2C.
This answer is for the case of bit-banging using GPIO.
To implement and open-drain type output required, you should only drive the line low, and let it float high by configuring it as high-Z or input. (Also, when you let it float, there will be a requirement to read it in case the slave drives it low).
The following pseudo-code illustrates an open-drain type output for bit-banging
void init_pin_for_i2c(int pin) {
// Initialise for high impedance (for idle)
gpio_set_mode(pin, HIGH_Z);
// Now set the output to zero, this is the only value we will ever drive onto the bus
// It will only be driven to the bus when we switch the mode to OUTPUT
gpio_write_value(pin, 0);
}
void write_pin_for_i2c(int pin, int val) {
if (val == 1) {
// To "write" a 1 to the bus, let the pin float high
gpio_set_mode(pin, HIGH_Z);
} else {
// Enable the output to assert zero on the bus
gpio_set_mode(pin, OUTPUT);
}
Note that for HIGH_Z you may need to use mode INPUT, depending on your API and your MCU.