Clean up imports and switch to socket.inet_aton for validating an IP