def validate_identifier(value, start_with_uppercase_letter=False, max_len=256):
    if not value:
        raise ValueError(_("Should not be empty"))

    safe_chars = set("_%s%s" % (string.ascii_letters, string.digits))
    ok = all(c in safe_chars for c in value)
    if not ok:
        raise ValueError(_('Should only contain ascii letters, digits or underscore characters'))

    if start_with_uppercase_letter:
        if value[0] not in string.ascii_uppercase:
            raise ValueError(_("Should start with an uppercase ascii letter"))
    else:
        if value[0] not in string.ascii_letters:
            raise ValueError(_("Should start with an ascii letter"))

    if len(value) > max_len:
        raise ValueError(
            _("Identifier too long (max. %d characters)") % max_len)

    return value
Return the slab descriptor for a key.
dataset/ETHPy150Open Net-ng/kansha/kansha/validator.py/validate_identifier--crossover with--dataset/ETHPy150Open MapQuest/mapquest-osm-server/src/python/datastore/lrucache.py/LRUCache.get_slab