<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def check_sockets(self):
        '''
        Check for new messages on sockets and respond accordingly.


        .. versionchanged:: 0.11.3
            Update routes table by setting ``df_routes`` property of
            :attr:`parent.canvas_slave`.

        .. versionchanged:: 0.12
            Update ``dynamic_electrode_state_shapes`` layer of
            :attr:`parent.canvas_slave` when dynamic electrode actuation states
            change.

        .. versionchanged:: 0.13
            Update local global, electrode, and route command lists in response
            to ``microdrop.command_plugin`` messages.
        '''
        try:
            msg_frames = (self.command_socket
                          .recv_multipart(zmq.NOBLOCK))
        except zmq.Again:
            pass
        else:
            self.on_command_recv(msg_frames)

        try:
            msg_frames = (self.subscribe_socket
                          .recv_multipart(zmq.NOBLOCK))
            source, target, msg_type, msg_json = msg_frames

            if ((source == 'microdrop.device_info_plugin') and
                (msg_type == 'execute_reply')):
                msg = json.loads(msg_json)
                if msg['content']['command'] == 'get_device':
                    data = decode_content_data(msg)
                    if data is not None:
                        self.parent.on_device_loaded(data)
            elif ((source == 'microdrop.electrode_controller_plugin') and
                (msg_type == 'execute_reply')):
                msg = json.loads(msg_json)
                if msg['content']['command'] in ('set_electrode_state',
                                                 'set_electrode_states'):
                    data = decode_content_data(msg)
                    if data is None:
                        print msg
                    else:
                        #self.emit('electrode-states-updated', data)
                        self.parent.on_electrode_states_updated(data)
                elif msg['content']['command'] == 'get_channel_states':
                    data = decode_content_data(msg)
                    if data is None:
                        print msg
                    else:
                        #self.emit('electrode-states-set', data)
                        self.parent.on_electrode_states_set(data)
            elif ((source == 'droplet_planning_plugin') and
                  (msg_type == 'execute_reply')):
                msg = json.loads(msg_json)
                if msg['content']['command'] in ('add_route', ):
                    self.execute_async('droplet_planning_plugin',
                                       'get_routes')
                elif msg['content']['command'] in ('get_routes', ):
                    data = decode_content_data(msg)
                    self.parent.canvas_slave.df_routes = data
            elif ((source == 'microdrop.command_plugin') and
                  (msg_type == 'execute_reply')):
                msg = json.loads(msg_json)

                if msg['content']['command'] in ('get_commands',
                                                 'unregister_command',
                                                 'register_command'):
                    df_commands = decode_content_data(msg).set_index('namespace')

                    for group_i, df_i in df_commands.groupby('namespace'):
                        register = getattr(self.parent.canvas_slave,
                                           'register_%s_command' % group_i,
                                           None)
                        if register is None:
                            continue
                        else:
                            for j, command_ij in df_i.iterrows():
                                register(command_ij.command_name,
                                         title=command_ij.title,
                                         group=command_ij.plugin_name)
                                _L().debug('registered %s command: `%s`',
                                           group_i, command_ij)
            else:
                self.most_recent = msg_json
        except zmq.Again:
            pass
        except:
            logger.error('Error processing message from subscription '
                         'socket.', exc_info=True)

        return True