@classmethod
def check_token(cls, db, token):
    """Check if a token is acceptable"""
    if len(token) < cls.min_length:
        raise ValueError('Tokens must be at least %i characters, got %r' %
            (cls.min_length, token))
    found = cls.find(db, token)
    if found:
        raise ValueError('Collision on token: %s...' % token[:cls.
            prefix_length])
