code: def _pad_patch_list(plist, bgcolor):
      if isinstance(bgcolor, int):
          bgcolor = (bgcolor, bgcolor, bgcolor)
  
      def _pad_channel(plist):
          ret = []
          for p in plist:
              if len(p.shape) == 2:
                  p = p[:, :, np.newaxis]
              if p.shape[2] == 1:
                  p = np.repeat(p, 3, 2)
              ret.append(p)
          return ret
  
      plist = _pad_channel(plist)
      shapes = [x.shape for x in plist]
      ph = max(s[0] for s in shapes)
      pw = max(s[1] for s in shapes)
  
      ret = np.zeros((len(plist), ph, pw, 3), dtype=plist[0].dtype)
      ret[:, :, :] = bgcolor
      for idx, p in enumerate(plist):
          s = p.shape
          sh = (ph - s[0]) // 2
          sw = (pw - s[1]) // 2
          ret[idx, sh : sh + s[0], sw : sw + s[1], :] = p
      return ret
  
file_path: tensorpack/tensorpack/utils/viz.py
imports: import numpy
  import os
  import sys
  from ..utils.develop import create_dummy_func
  from .argtools import shape2d
  from .fs import mkdir_p
label_desc: Use image node_id 3 for calling a global function with example usage: _pad_patch_list(plist, bgcolor) and returns: ret, ret