code: def pre_run(self, args, options):
          
          if 'generate' in args and args['generate']:
              self.metadata_provider = CsvMetadataProvider(args['channeldir'],
                                                      channelinfo=args['channelinfo'],
                                                      contentinfo=args['contentinfo'],
                                                      exercisesinfo=args['exercisesinfo'],
                                                      questionsinfo=args['questionsinfo'],
                                                      validate_and_cache=False)
              self.metadata_provider.generate_templates(exercise_questions=True)
              self.metadata_provider.generate_contentinfo_from_channeldir(args, options)
              sys.exit(0)
  
          elif 'importstudioid' in args and args['importstudioid']:
              studio_id = args['importstudioid']
              config.LOGGER.info("Calling with importstudioid... " + studio_id)
              self.metadata_provider = CsvMetadataProvider(args['channeldir'],
                                                      channelinfo=args['channelinfo'],
                                                      contentinfo=args['contentinfo'],
                                                      exercisesinfo=args['exercisesinfo'],
                                                      questionsinfo=args['questionsinfo'],
                                                      validate_and_cache=False)
              self.metadata_provider.generate_templates(exercise_questions=True)
              self.metadata_provider.generate_exercises_from_importstudioid(args, options)
              sys.exit(0)
  
          if self.metadata_provider is None:
              self._init_metadata_provider(args, options)
          kwargs = {}   # combined dictionary of argparse args and extra options
          kwargs.update(args)
          kwargs.update(options)
          json_tree_path = self.get_json_tree_path(**kwargs)
          build_ricecooker_json_tree(args, options, self.metadata_provider, json_tree_path)
docs: This function is called before `run` in order to build the json tree.