'Extracts and returns a single value from a DataBlob.'

def GetValue(self, ignore_error=True):

    if self.HasField('none'):
        return None
    field_names = ['integer', 'string', 'data', 'boolean', 'list', 'dict', 'rdf_value', 'float', 'set']
    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])
    if self.HasField('rdf_value'):
        try:
            rdf_class = rdfvalue.RDFValue.classes[self.rdf_value.name]
            return rdf_class.FromSerializedString(self.rdf_value.data, age=self.rdf_value.age)
        except (ValueError, KeyError) as e:
            if ignore_error:
                return e
            raise
    elif self.HasField('list'):
        return [x.GetValue() for x in self.list.content]
    elif self.HasField('set'):
        return set([x.GetValue() for x in self.set.content])
    else:
        return values[0]
