code: def _resolve_fallback(self, gates, n_qubits):
          
          flattened = []
          for g in gates:
              if self._has_action(g):
                  flattened.append(g)
              else:
                  flattened += self._resolve_fallback(g.fallback(n_qubits), n_qubits)
          return flattened
docs: Resolve fallbacks and flatten gates.