docs: def calc_transition_to_state(self, newstate):
          """Given a target state, generate the sequence of transitions that would move this state machine instance to that target state.
  
          Args:
              newstate: A str state name to calculate the path to.
  
          Returns:
              A bitarray containing the bits that would transition this
              state machine to the target state. The bits read from right
              to left. For efficiency, this retulting bitarray is cached.
              Do not edit this bitarray, or it will cause undefined
              behavior.
          """
          cached_val = JTAGStateMachine._lookup_cache.\
                       get((self.state, newstate))
          if cached_val:
              return cached_val
  
          if newstate not in self.states:
              raise ValueError("%s is not a valid state for this state "
                               "machine"%newstate)
  
          path = self._find_shortest_path(self._statestr, newstate)
          if not path:
              raise ValueError("No path to the requested state.")
          res = self._get_steps_from_nodes_path(path)
          res.reverse()
          JTAGStateMachine._lookup_cache[(self.state, newstate)] = res
          return res