def static_vars(**kwargs):
    """Python decorator to declare static variables on a method.

    NOTE: Relies on the Python feature that allows attributes to be added to a
    function.  See:

        http://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-variables-inside-a-function

    for source of decorator code and additional information.
    """
    def decorate(func):
        for k in kwargs:
            setattr(func, k, kwargs[k])
        return func
    return decorate