Decode the value to the required type.

def Decode(self, attribute, value):
    """Decode the value to the required type."""
    required_type = self._attribute_types.get(attribute, "bytes")
    if required_type == "integer":
      return rdf_structs.SignedVarintReader(value, 0)[0]
    elif required_type == "unsigned_integer":
      return rdf_structs.VarintReader(value, 0)[0]
    elif required_type == "string":
      if isinstance(value, bytes):
        return value.decode("utf-8")
      else:
        return utils.SmartUnicode(value)
    else:
      return value