code: def interp(var, indexes_coords, method, **kwargs):
      if not indexes_coords:
          return var.copy()
      if method in ['linear', 'nearest']:
          var, indexes_coords = _localize(var, indexes_coords)
      kwargs['bounds_error'] = kwargs.get('bounds_error', False)
      dims = list(indexes_coords)
      x, new_x = zip(*[indexes_coords[d] for d in dims])
      destination = broadcast_variables(*new_x)
      broadcast_dims = [d for d in var.dims if d not in dims]
      original_dims = broadcast_dims + dims
      new_dims = broadcast_dims + list(destination[0].dims)
      interped = interp_func(var.transpose(*original_dims).data,
                             x, destination, method, kwargs)
      result = Variable(new_dims, interped, attrs=var.attrs)
      out_dims = OrderedSet()
      for d in var.dims:
          if d in dims:
              out_dims.update(indexes_coords[d][1].dims)
          else:
              out_dims.add(d)
      return result.transpose(*tuple(out_dims))