'Helper function used for prev_gray and next_gray.
It performs k step overs to get the respective Gray codes.
Examples
>>> from sympy.combinatorics.subsets import Subset
>>> a = Subset([1, 2, 3], [1, 2, 3, 4])
>>> a.iterate_graycode(3).subset
[1, 4]
>>> a.iterate_graycode(-2).subset
[1, 2, 4]
See Also
next_gray, prev_gray'

def iterate_graycode(self, k):

    unranked_code = GrayCode.unrank(self.superset_size, ((self.rank_gray + k) % self.cardinality))
    return Subset.subset_from_bitlist(self.superset, unranked_code)
