Use python code to control I2C (TX2)

I want to use TX2 to control PCA9685.
However, only C++ language version of PCA9685 on the web
I found the following problem when I modified it to the python version:

sudo i2cdetect -y -r 1

It can successfully display the 0x70 position

IOCTL_I2C_SLAVE = 0x703
fw = io.open ("/dev/i2c-1",wb)
fcntl.ioctl(fw, IOCTL_I2C_SLAVE, 0x70)

Can successfully return 0, which means successful open file

But when I want to write a signal, there is a problem.

I want to output value is 400 in pin 7

value       = 400
address     = 7

LED0_ON_L   = 0x06
LED0_ON_H   = 0x07
LED0_OFF_L  = 0x08
LED0_OFF_H  = 0x09
def write (address, value):
   fw = io.open ("/dev/i2c-1",wb)
   fcntl.ioctl(fw, (LED0_ON_L+4*address), 0)
   fcntl.ioctl(fw, (LED0_ON_H+4*address), 0)
   fcntl.ioctl(fw, (LED0_ON_L+4*address), (value  & 0xFF))
   fcntl.ioctl(fw, (LED0_ON_H+4*address), (value  >> 8))

It show the following error:
IOError: [Errno 25] Inappropriate ioctl for device

I want to know how to input signals, Let the PCA9685 generate a PWM signal

How about use i2cset?

@martinsit011138, were you able to resolve this?