def METHOD_NAME(fd, data):
    # Another quick twist
    while True:
        try:
            data_length = len(data)
            wrote_data = os.write(fd, data)
        except (OSError, IOError) as io:
            if io.errno in (errno.EAGAIN, errno.EINTR):
                continue
            else:
                raise
        if wrote_data < data_length:
            METHOD_NAME(fd, data[wrote_data:])
        break