def read_write(<EOL>adr,<EOL>index_group,<EOL>index_offset,<EOL>plc_read_datatype,<EOL>value,<EOL>plc_write_datatype,<EOL>return_ctypes=False,<EOL>):<EOL>
if port is not None:<EOL><INDENT>return adsSyncReadWriteReqEx2(<EOL>port,<EOL>adr,<EOL>index_group,<EOL>index_offset,<EOL>plc_read_datatype,<EOL>value,<EOL>plc_write_datatype,<EOL>return_ctypes,<EOL>)<EOL><DEDENT>return None<EOL>
Read and write data synchronous from/to an ADS-device.

    :param AmsAddr adr: local or remote AmsAddr
    :param int index_group: PLC storage area, according to the INDEXGROUP
        constants
    :param int index_offset: PLC storage address
    :param Type plc_read_datatype: type of the data given to the PLC to respond
            to, according to PLCTYPE constants
        :param value: value to write to the storage address of the PLC
    :param Type plc_write_datatype: type of the data given to the PLC, according to
        PLCTYPE constants
    :param bool return_ctypes: return ctypes instead of python types if True
        (default: False)
    :rtype: PLCTYPE
    :return: value: **value**