Better to just do: `if len(os.path.dirname(filename)): raise ValueError("Can't pass a directory path to ensure_clean")` and then just do `filename = filename or ''` before that.