'Format raw data into easily accessible dict.'

def data_format(self):

    for attr_key in self.conditions:
        value = MONITORED_CONDITIONS[attr_key]
        try:
            primary_key = value[0][0]
            sensor_key = value[0][1]
            if (primary_key in self.raw_data):
                sensor_value = self.raw_data[primary_key][sensor_key]
                if ((attr_key == ATTR_NEW_VERSION) and (sensor_value == '0.0.0.0')):
                    sensor_value = 'Latest'
                elif (attr_key == ATTR_UPTIME):
                    sensor_value = round((sensor_value / (3600 * 24)), 2)
                elif (attr_key == ATTR_LAST_RESTART):
                    last_restart = (dt.now() - timedelta(seconds=sensor_value))
                    sensor_value = last_restart.strftime('%Y-%m-%d    %H:%M:%S')
                elif (attr_key == ATTR_STATUS):
                    if sensor_value:
                        sensor_value = 'Online'
                    else:
                        sensor_value = 'Offline'
                elif (attr_key == ATTR_LOCAL_IP):
                    if (not self.raw_data['wan']['online']):
                        sensor_value = STATE_UNKNOWN
                self.data[attr_key] = sensor_value
        except KeyError:
            _LOGGER.error('Router    does    not    support    %s    field.    Please    remove    %s    from    monitored_conditions', sensor_key, attr_key)
            self.data[attr_key] = STATE_UNKNOWN
