def try_beautify(x):
    try:
        x = beautify(x)
    except:
        pass
    return x
        code = parser.random_code(stmt_max_depth=config.max_depth,
                                  min_move_func=config.min_move_func,
                                  create_hit_info=True)
        return code

    if config.mode == 'text':
        for name in datasets:
            data_num = getattr(config, "num_{}".format(name))

            text = ""
            text_path = os.path.join(config.data_dir, "{}.txt".format(name))

            for _ in trange(data_num, desc=name):
                code = generate()
                if config.beautify:
                    code = beautify(code)
                text += code + "\n"

            with open(text_path, 'w') as f:
                f.write(text)
    else:
        for name in datasets:
            data_num = getattr(config, "num_{}".format(name))

            inputs, outputs, codes, code_lengths = [], [], [], []
            input_strings, output_strings = [], []

            for _ in trange(data_num, desc=name):
                while True:
                    input_examples, output_examples = [], []
                    input_string_examples, output_string_examples = [], []