Does `TypeError` is correct one there since actually this condition checks for the value of `role`, not for his type. May be raise `ValueError` in this case?