code: def substitute(self, data: str) -> str:
      tokens = tokenize(data)
      font = random.sample(self.fonts, 1)[0]
      results = []
  
      if self.granularity == "word":
          aug_word_cnt = self._generate_aug_cnt(
              len(tokens), self.aug_min, self.aug_max, self.aug_p
          )
          aug_word_idxes = set(
              get_aug_idxes(
                  self,
                  tokens,
                  list(range(len(tokens))),
                  aug_word_cnt,
                  Method.WORD,
              )
          )
  
          for i, token in enumerate(tokens):
              if i not in aug_word_idxes:
                  results.append(token)
                  continue
  
              if self.vary_fonts:
                  font = random.sample(self.fonts, 1)[0]
  
              results.append(self.apply_font(token, font, Method.WORD))
  
      elif self.granularity == "char":
          all_chars = [char for token in tokens for char in list(token)]
          aug_char_idxes = set(self.generate_aug_idxes(all_chars))
          char_idx = 0
  
          for token in tokens:
              result = ""
              chars = list(token)
  
              for char in chars:
                  if self.vary_fonts:
                      font = random.sample(self.fonts, 1)[0]
                  if char_idx not in aug_char_idxes:
                      result += char
                  else:
                      result += self.apply_font(char, font, Method.CHAR)
                  char_idx += 1
  
              results.append(result)
  
      else:
          if random.random() < self.aug_p:
              for token in tokens:
                  results.append(
                      self.apply_font(token, font, Method.WORD)
                  )
          else:
              results = tokens
  
      return detokenize(results)
  
file_path: AugLy/augly/text/augmenters/fun_fonts.py
imports: import json
  import random
  from typing import List, Optional, Union
  from augly.text.augmenters.utils import detokenize, get_aug_idxes, tokenize
  from augly.utils import pathmgr
  from augly.utils.libsndfile import install_libsndfile
  from nlpaug import Augmenter
  from nlpaug.util import Action, Method
label_desc: Use image node_id 6 for calling the FunFontsAugmenter obj's underlying member method code with example usage: obj.substitute(data) and returns: detokenize