code: def decode_complementarity(comp, control):
  
      '''
      # comp can be either:
      - None
      - "a<=expr" where a is a controls
      - "expr<=a" where a is a control
      - "expr1<=a<=expr2"
      '''
  
      try:
          res = regex.match(comp).groups()
      except:
          raise Exception("Unable to parse complementarity condition '{}'".format(comp))
      res = [r.strip() for r in res]
      if res[1] != control:
          msg = "Complementarity condition '{}' incorrect. Expected {} instead of {}.".format(comp, control, res[1])
          raise Exception(msg)
      return [res[0], res[2]f decode_complementarity(comp, control):
  
      '''
      # comp can be either:
      - None
      - "a<=expr" where a is a controls
      - "expr<=a" where a is a control
      - "expr1<=a<=expr2"
      '''
  
      try:
          res = regex.match(comp).groups()
      except:
          raise Exception("Unable to parse complementarity condition '{}'".format(comp))
      res = [r.strip() for r in res]
      if res[1] != control:
          msg = "Complementarity condition '{}' incorrect. Expected {} instead of {}.".format(comp, control, res[1])
          raise Exception(msg)
      return [res[0], res[2]]
docs: # comp can be either:
      - None
      - "a<=expr" where a is a controls
      - "expr<=a" where a is a control
      - "expr1<=a<=expr2"