def static_vars(**kwargs):
    """Decorator for adding static variables to a function.
    
    Example:

        @static_vars(counter=0)
        def some_function():
            # Static variable keeps value between calls
            some_function.counter += 1
            return some_function.counter
    """
    def decorate(func):
        for k in kwargs:
            setattr(func, k, kwargs[k])
        return func
    return decorate