RFID- RC522 library

Hi,I would like to use an RFID MFRC522 on an ESP32 Devkit C board.
I’m trying to port the library from micropython but i don’t know how to translate the following function:
def Write_MFRC522(self, addr, val):

since spi.exchange requires only data

This depends on the functionality of transfer method.
If the functionality of transfer is to send the 1st argument and save the received data in the second argument, Then You can use the exchange method as :
val = spi.exchange( ((addr<<1)&0x7E)

If SPI.transfer in micropython has different functionality, let me know.