def path_to_str(path):
    """ Convert pathlib.Path objects to str; return other objects as-is. """
    try:
        from pathlib import Path as _Path
    except ImportError:  # Python < 3.4
        class _Path:
            pass
    if isinstance(path, _Path):
        return str(path)
    return path
def path_to_str ( path ) : try : from pathlib import Path as _Path except ImportError : class _Path : pass if isinstance ( path , _Path ) : return str ( path ) return path
Convert pathlib.Path objects to str; return other objects as-is.