code: def swap(word, num=1, skip_first=False, skip_last=False):
      """
      Swaps random characters with their neighbors.
  
      :param str word: target word
      :param int num: number of typos to add
      :param bool skip_first: whether swap first char of word
      :param bool skip_last: whether swap last char of word
      :return: perturbed strings
      """
  
      if len(word) <= 1:
          return word
  
      chars = list(word)
      start, end = get_start_end(word, skip_first, skip_last)
  
      # error swap num, return original word
      if end - start < num:
          return None
  
      swap_idxes = random.sample(list(range(start, end)), num)
  
      for swap in swap_idxes:
          tmp = chars[swap]
          chars[swap] = chars[swap + 1]
          chars[swap + 1] = tmp
  
      return "".join(chars)
  
imports: import random
  import string
label_desc: Use image node_id 3 for calling a global function with example usage: swap(word, num, skip_first, skip_last) and returns: str, word, None