def bump():
count = count + 1
Python determines that count is a local name while analyzing the function's code, before the function body is executed. When the function is called, Python evaluates the RHS first, and it already knows that this count refers to the local count.
UnboundLocalError occurs when you've performed an assignment operation on a variable which Python determines to be local and thus tries to read it, but hasn't been assigned a value yet.