code: def reorder_image(dst_order, src_arr, src_order):
      
      depth = src_arr.shape[2]
      if depth != len(src_order):
          raise ValueError("src_order (%s) does not match array depth (%d)" % (
              src_order, depth))
  
      bands = []
      if dst_order == src_order:
          return np.ascontiguousarray(src_arr)
  
      elif 'A' not in dst_order or 'A' in src_order:
          # <-- we don't have to add an alpha plane, just create a new view
          idx = np.array([src_order.index(c) for c in dst_order])
          return np.ascontiguousarray(src_arr[..., idx])
  
      else:
          # <-- dst order requires missing alpha channel
          indexes = [src_order.index(c) for c in dst_order.replace('A', '')]
          bands = [src_arr[..., idx, np.newaxis] for idx in indexes]
          ht, wd = src_arr.shape[:2]
          dst_type = src_arr.dtype
          dst_max_val = np.iinfo(dst_type).max
          alpha = np.full((ht, wd, 1), dst_max_val, dtype=dst_type)
          bands.insert(dst_order.index('A'), alpha)
  
      return np.concatenate(bands, axis=-1)
docs: Reorder src_arr, with order of color planes in src_order, as
      dst_order.