'Check that the value is of the expected type.
Args:
attribute: An instance of Attribute().
value: An instance of RDFValue.
Raises:
ValueError: when the value is not of the expected type.
AttributeError: When the attribute is not of type Attribute().'

def _CheckAttribute(self, attribute, value):

    if (not isinstance(attribute, Attribute)):
        raise AttributeError('Attribute    %s    must    be    of    type    aff4.Attribute()', attribute)
    if (not isinstance(value, attribute.attribute_type)):
        raise ValueError(('Value    for    attribute    %s    must    be    of    type    %s()' % (attribute, attribute.attribute_type.__name__)))
