code: def array_convert_function(sshape_one, sshape_two, variables):
      
      if not isinstance(sshape_one, tuple): sshape_one = (sshape_one,)
      if not isinstance(sshape_two, tuple): sshape_two = (sshape_two,)
  
      s_one = flatten([eval_expr_names_and_nrs(d) if isinstance(d,str) else d
          for d in sshape_one])
      s_two = flatten([eval_expr_names_and_nrs(d) if isinstance(d,str) else d
          for d in sshape_two])
  
      if len(s_one) != len(s_two):
          raise ValueError, ('Flattened shapes %s and %s '\
              'do not have the same length. '
              'Original shapes were %s and %s') % \
              (s_one, s_two, sshape_one, sshape_two)
  
      # Reason about the transpose
      t_idx = tuple([s_one.index(v) for v in s_two])
  
      # Figure out the actual numeric shape values to use
      n_one = shape_from_str_tuple(s_one, variables)
      n_two = [eval_expr(d,variables)
          if isinstance(d,str) else d for d in sshape_two]
  
      def f(ary): return np.reshape(ary, n_one).transpose(t_idx).reshape(n_two)
  
      return f
docs: Return a function defining the conversion process between two NumPy
      arrays of different shapes