Generate next slug for a series.

       Some docstore types will use slugs (see above) as document ids. To
       support unique ids, we'll serialize them as follows:
         TestUserA/my-test
         TestUserA/my-test-2
         TestUserA/my-test-3
         ...

def increment_slug(s):
    """Generate next slug for a series.

       Some docstore types will use slugs (see above) as document ids. To
       support unique ids, we'll serialize them as follows:
         TestUserA/my-test
         TestUserA/my-test-2
         TestUserA/my-test-3
         ...
    """
    slug_parts = s.split('-')
    # advance (or add) the serial counter on the end of this slug
    # noinspection PyBroadException
    try:
        # if it's an integer, increment it
        slug_parts[-1] = str(1 + int(slug_parts[-1]))
    except:
        # there's no counter! add one now
        slug_parts.append('2')
    return '-'.join(slug_parts)