code: def _rotate(n, x, y, rx, ry):
      
      if ry == 0:
          if rx == 1:
              x = n - 1 - x
              y = n - 1 - y
          return y, x
      return x, y
docs: Rotate and flip a quadrant appropriately
  
      Based on the implementation here:
          https://en.wikipedia.org/w/index.php?title=Hilbert_curve&oldid=797332503