Explain how memory management works in Python, specifically regarding reference counting and garbage collection.