'Validates a python format representation of the value.'

def Validate(self, value, **_):

    if (not ((value.__class__ is str) or (value.__class__ is unicode) or (value.__class__ is rdfvalue.RDFString))):
        raise type_info.TypeValueError(('%s    not    a    valid    string' % value))
    if (value.__class__ is unicode):
        return value
    try:
        try:
            return value.__unicode__()
        except AttributeError:
            return unicode(value, 'utf8')
    except UnicodeError:
        raise type_info.TypeValueError('Not    a    valid    unicode    string')
