code: def dict_to_object(self, obj):  # pylint: disable=no-self-use
          
          if not isinstance(obj, dict):
              return obj
          if 'sensor_id' in obj:
              sensor = Sensor(obj['sensor_id'])
              for key, val in obj.items():
                  setattr(sensor, key, val)
              return sensor
          if all(k in obj for k in ['id', 'type', 'values']):
              child = ChildSensor(
                  obj['id'], obj['type'], obj.get('description', ''))
              child.values = obj['values']
              return child
          if all(k.isdigit() for k in obj.keys()):
              return {int(k): v for k, v in obj.items()}
          return obj
docs: Return object from dict.