def rr_op(left, right):
 if (len(right) > 0):
  rr_gate = right[(len(right) - 1)]
  rr_gate_is_unitary = is_scalar_matrix((Dagger(rr_gate), rr_gate), _get_min_qubits(rr_gate), True)
 if ((len(right) > 0) and rr_gate_is_unitary):
  new_right = right[0:(len(right) - 1)]
  new_left = (left + (Dagger(rr_gate),))
  return (new_left, new_right)
 return None

def rr_op ( left , right ) : if ( len ( right ) > 0 ) : rr_gate = right [ ( len ( right ) - 1 ) ] rr_gate_is_unitary = is_scalar_matrix ( ( Dagger ( rr_gate ) , rr_gate ) , _get_min_qubits ( rr_gate ) , True ) if ( ( len ( right ) > 0 ) and rr_gate_is_unitary ) : new_right = right [ 0 : ( len ( right ) - 1 ) ] new_left = ( left + ( Dagger ( rr_gate ) , ) ) return ( new_left , new_right ) return None
perform a rr operation .