def valid_filename(filename): allowed_chars = string.ascii_lowercase + string.digits + '.-_' return all(c in allowed_chars for c in filename) # checks if a given directory name matches naming requirements