I'd be tempted to pull this out as a local variable, which would mean that you don't need to have multiple returns in your function, and you also don't need to call dec_ref from multiple places.