This is subtly incorrect. Correctly, it should be:
libpaths = paths.split(":") if paths is not None else []
or else falsey values of paths (0, [], False) can still cause an error.