import os ALLOWED = [".mp4", ".mov", ".mkv"] def validate_video(path): if not os.path.exists(path): raise Exception("File not found") ext = os.path.splitext(path)[1].lower() if ext not in ALLOWED: raise Exception("Unsupported video format")