Receiving b'' when trying to enter command mode

I am trying to enter command mode by sending the command character. Instead of receiving “OK” I am receiving b’'. Here is my code:

def command_mode(command):
for _ in range(10): # Limit retry count
time.sleep(0.1)
ser.write(“+”.encode(“ascii”))
time.sleep(0.1)
ser.write(“+”.encode(“ascii”))
time.sleep(0.1)
ser.write(“+”.encode(“ascii”))
print(“+++”)
receive = ser.read(ser.in_waiting)
print(str(receive)) # I am receiving b’’
if str(receive).find(“OK”) != -1:
ser.write((command + “\r”).encode(“ascii”))
break

That sounds like you are entering the bootloader and not AT command mode. Check and see if you are holding the DI line low.