# Buggy code
def __init__(
    self,
    context,
    framer=None,
    identity=None,
    address=None,
    handler=None,
    allow_reuse_address=False,
    **kwargs,
):
    """Overloaded initializer for the socket server

    If the identify structure is not passed in, the ModbusControlBlock
    uses its own empty structure.

    :param context: The ModbusServerContext datastore
    :param framer: The framer strategy to use
    :param identity: An optional identify structure
    :param address: An optional (interface, port) to bind to.
    :param handler: A handler for each client session; default is
                    ModbusConnectedRequestHandler
    :param allow_reuse_address: Whether the server will allow the
                    reuse of an address.
    :param ignore_missing_slaves: True to not send errors on a request
                                    to a missing slave
    """
    self.threads = []
    self.allow_reuse_address = allow_reuse_address
    self.decoder = ServerDecoder()
    self.framer = framer or ModbusSocketFramer
    self.context = context or ModbusServerContext()
    self.control = ModbusControlBlock()
    self.address = address or ("", Defaults.Port)
    self.handler = handler or ModbusConnectedRequestHandler
    self.ignore_missing_slaves = kwargs.get(
        "ignore_missing_slaves", Defaults.IgnoreMissingSlaves
    )

    if isinstance(identity, ModbusDeviceIdentification):
        self.control.Identity.update(identity)

    socketserver.ThreadingTCPServer.__init__(self, self.address, self.handler)


# Traceback (AttributeError)
client = ModbusSerialClient(port='notexist', method='rtu')
client.connect()
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "lib/python3.6/site-packages/pymodbus/client/sync.py", line 476, in connect
self.socket.interCharTimeout = self.inter_char_timeout
AttributeError: 'NoneType' object has no attribute 'interCharTimeout'

# Fixed code
def __init__(
    self,
    context,
    framer=None,
    identity=None,
    address=None,
    handler=None,
    allow_reuse_address=False,
    **kwargs,
):
    """Overloaded initializer for the socket server

    If the identify structure is not passed in, the ModbusControlBlock
    uses its own empty structure.

    :param context: The ModbusServerContext datastore
    :param framer: The framer strategy to use
    :param identity: An optional identify structure
    :param address: An optional (interface, port) to bind to.
    :param handler: A handler for each client session; default is
                    ModbusConnectedRequestHandler
    :param allow_reuse_address: Whether the server will allow the
                    reuse of an address.
    :param ignore_missing_slaves: True to not send errors on a request
                    to a missing slave
    :param broadcast_enable: True to treat unit_id 0 as broadcast address,
                    False to treat 0 as any other unit_id
    """
    self.threads = []
    self.allow_reuse_address = allow_reuse_address
    self.decoder = ServerDecoder()
    self.framer = framer or ModbusSocketFramer
    self.context = context or ModbusServerContext()
    self.control = ModbusControlBlock()
    self.address = address or ("", Defaults.Port)
    self.handler = handler or ModbusConnectedRequestHandler
    self.ignore_missing_slaves = kwargs.get(
        "ignore_missing_slaves", Defaults.IgnoreMissingSlaves
    )
    self.broadcast_enable = kwargs.get("broadcast_enable", Defaults.broadcast_enable)

    if isinstance(identity, ModbusDeviceIdentification):
        self.control.Identity.update(identity)

    socketserver.ThreadingTCPServer.__init__(self, self.address, self.handler)