code: def process_ret(ret, ret_m=None, meta=False, n=10):
      if ret:
          if len(ret) > n:
              idxs = np.random.choice(len(ret), n, replace=False)
              ret = [ret[i] for i in idxs]
              if ret_m:
                  ret_m = [ret_m[i] for i in idxs]
          if meta:
              ret = (ret, ret_m)
          return ret
      return None
  
imports: import numpy
  import collections
  import re
  import os
  import json
  import pattern
  from pattern.en import tenses
  from .editor import recursive_apply, MunchWithAdd
label_desc: Use image node_id 2 for calling a global function with example usage: process_ret(ret, ret_m, meta, n) and returns: None, ret