Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Performs basic VIN validation and sanation.
:param num:
"""
num = num.strip().upper()
num_len = len(num)
if num_len != 17:
raise ValidationError(f'VIN number requires 17 chars ({num_len} given)')
illegal = {'I', 'O', 'Q'}
for ch in num:
if ch in illegal:
raise ValidationError(f"VIN number should not contain: {', '.join(illegal)}")
return num