code: def dump_state(self):
          
  
          # Dump the state of all of the tiles
          def _background_dump():
              state = super(ReferenceDevice, self).dump_state()
  
              state['state_name'] = self.STATE_NAME
              state['state_version'] = self.STATE_VERSION
              state['reset_count'] = self.reset_count
              state['received_script'] = base64.b64encode(self.script).decode('utf-8')
  
              return state
  
          return self.synchronize_task(_background_dump)
docs: Dump the current state of this emulated object as a dictionary.
  
          Note that dump_state happens synchronously in the emulation thread to
          avoid any race conditions with accessing data members and ensure a
          consistent view of all state data.
  
          Returns:
              dict: The current state of the object that could be passed to load_state.