code: def permutations(iterable, r=None):
      """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)"""
      pool = tuple(iterable)
      n = len(pool)
      if r is None:
          r = n
      indices = range(n)
      cycles = range(n - r + 1, n + 1)[::-1]
      yield tuple(pool[i] for i in indices[:r])
      while n:
          for i in reversed(xrange(r)):
              cycles[i] -= 1
              if cycles[i] == 0:
                  indices[i:] = indices[i + 1 :] + indices[i : i + 1]
                  cycles[i] = n - i
              else:
                  j = cycles[i]
                  indices[i], indices[-j] = indices[-j], indices[i]
                  yield tuple(pool[i] for i in indices[:r])
                  break
          else:
              return
  
label_desc: Use image node_id 1 for calling a global function with example usage: permutations(iterable, r) without return types