code: def _switch_partition() -> RootPartitions:
      
      res = subprocess.check_output(['ot-switch-partitions'])
      for line in res.split(b'\n'):
          matches = re.match(
              b'Current boot partition: ([23]), setting to ([23])',
              line)
          if matches:
              return {b'2': RootPartitions.TWO,
                      b'3': RootPartitions.THREE}[matches.group(2)]
      else:
          raise RuntimeError(f'Bad output from ot-switch-partitions: {res}')
docs: Switch the active boot partition using the switch script