remove trailing whitespace
PEP8 compliance
add global keyword to highlight the fact that _cache_lock is a module-wide variable