def _check_categories(line, categories):
    """ Throws an exception if the line does not match categories
    """
    kw_groups = line.split(',')
    kw_groups.pop(-1)
    if kw_groups != categories:
        raise TypeError('%s is not equal to %s' % (kw_groups, categories))
