Aw man. Just show the code.
Also - gpiod is purely for GPIO (binary read/write to/from lines) functionality. It doesn’t do anything else.
I believe I already mentioned this - to use UART use pyserial, to use I2C use smbus2.
As to SPI and PWM I do not know. There’s probably libraries for that too.