@classmethod
def _norm_ident(cls, ident):
    """
        helper which normalizes & validates 'ident' value.
        """
    assert ident is not None
    if isinstance(ident, bytes):
        ident = ident.decode('ascii')
    iv = cls.ident_values
    if ident in iv:
        return ident
    ia = cls.ident_aliases
    if ia:
        try:
            value = ia[ident]
        except KeyError:
            pass
        else:
            if value in iv:
                return value
    raise ValueError('invalid ident: %r' % (ident,))
