Increments context variables

def incr_obj(obj, **attrs):
    """Increments context variables
    """
    for name, value in attrs.iteritems():
        v = getattr(obj, name, None)
        if not hasattr(obj, name) or v is None:
            v = 0
        setattr(obj, name, v + value)