code: def get_src_findex_with_reflect_pad(s, S, align_corners):
      def reflect(s, L, U):
          length = U - L
          if s < L:
              d = L - s
              nf = d / length
              n = int(np.floor(nf))
              r = d - n * length
              if n % 2 == 0:
                  return L + r
              else:
                  return U - r
          elif s > U:
              d = s - U
              nf = d / length
              n = int(np.floor(nf))
              r = d - n * length
              if n % 2 == 0:
                  return U - r
              else:
                  return L + r
          else:
              return s
  
      if align_corners:
          return reflect(s, 0.0, S - 1.0)
      else:
          sf = reflect(2 * s, -1, 2 * S - 1)
          sf *= 0.5
          return sf
  
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
  from refs import generate_transformation_2d, generate_transformation_3d, affine_grid_2d, affine_grid_3d, ChannelLastToFirstTranspose
  from itertools import product
label_desc: Use image node_id 6 for calling a global function with example usage: get_src_findex_with_reflect_pad(s, S, align_corners) and returns: reflect, sf, unknown, unknown, s, unknown, unknown