human
Complete this python program:
def find_variables(data, include_named=True):
assistant
#Here is the Python program you requested.

    """Finds all substitutable variables.
    This uses Template.pattern, which is arguably
    an implementation detail of string.Template.
    """
    found = set()
    def f(val):
        if (not isinstance(val, basestring)):
            return
        for match in Template.pattern.finditer(val):
            name = ((include_named and match.group('named')) or match.group('braced'))
            if (name is not None):
                found.add(name)
    recursive_walk(f, data)
    return found