import itertools


def get_variables(node):
    """Get a list with the variable names in a formula.

    :param node:

    :return: list of strings (variable names)
    """
    if 'condition' in node:
        return list(itertools.chain.from_iterable(
            [get_variables(sub_f) for sub_f in node['rules']]))

    return [node['id']]