'Generate and Increment the counter'

def generate(self):

    sequence_name = self.get_sequence_name()
    sequence_id = ('%s.%s' % (sequence_name, self.name))
    collection = get_db(alias=self.db_alias)[self.collection_name]
    counter = collection.find_and_modify(query={'_id': sequence_id}, update={'$inc': {'next': 1}}, new=True, upsert=True)
    return self.value_decorator(counter['next'])
