def GetValue(self, ignore_error=True):
    """Extracts and returns a single value from a DataBlob."""
    if self.HasField("none"):
      return None

    field_names = ["integer", "string", "data", "boolean", "list", "dict",
                   "rdf_value", "float"]

    values = [getattr(self, x) for x in field_names if self.HasField(x)]

    if len(values) != 1:
      return None

    if self.HasField("boolean"):
      return bool(values[0])

    # Unpack RDFValues.
    if self.HasField("rdf_value"):
      try:
        return rdfvalue.RDFValue.classes[self.rdf_value.name](
            initializer=self.rdf_value.data,
            age=self.rdf_value.age)
      except (__HOLE__, KeyError) as e:
        if ignore_error:
          return e

        raise

    elif self.HasField("list"):
      return [x.GetValue() for x in self.list.content]

    else:
      return values[0]
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/protodict.py/DataBlob.GetValue