'Returns a slug that is unique among user\'s importable items
for item\'s class.'

def get_unique_slug(self, item):

    cur_slug = item.slug
    if ((cur_slug is None) or (cur_slug == '')):
        slug_base = self._slugify(self._default_slug_base(item))
    else:
        slug_base = cur_slug
    new_slug = slug_base
    count = 1
    while (self.session().query(item.__class__).filter_by(user=item.user, slug=new_slug, importable=True).count() != 0):
        new_slug = ('%s-%i' % (slug_base, count))
        count += 1
    return new_slug
