'Validate keys and values.
Check to make sure every key used is a valid Vorbis key, and
that every value used is a valid Unicode or UTF-8 string. If
any invalid keys or values are found, a ValueError is raised.
In Python 3 all keys and values have to be a string.'

def validate(self):

    if (not isinstance(self.vendor, text_type)):
        if PY3:
            raise ValueError('vendor    needs    to    be    str')
        try:
            self.vendor.decode('utf-8')
        except UnicodeDecodeError:
            raise ValueError
    for (key, value) in self:
        try:
            if (not is_valid_key(key)):
                raise ValueError
        except TypeError:
            raise ValueError(('%r    is    not    a    valid    key' % key))
        if (not isinstance(value, text_type)):
            if PY3:
                raise ValueError(('%r    needs    to    be    str' % key))
            try:
                value.decode('utf-8')
            except:
                raise ValueError(('%r    is    not    a    valid    value' % value))
    return True
