code: def flip_labels(obj):
      
      def sub(a, b):
          """
          Substitute all keys that start with a to b
          """
          for label in list(obj.keys()):
              if label.startswith(a):
                  new_label = b+label[1:]
                  obj[new_label] = obj.pop(label)
  
      sub('x', 'z')
      sub('y', 'x')
      sub('z', 'y')
      return obj
docs: Rename fields x to y and y to x
  
      Parameters
      ----------
      obj : dict_like
          Object with labels to rename