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

def lr_op ( left , right ) : if ( len ( left ) > 0 ) : lr_gate = left [ ( len ( left ) - 1 ) ] lr_gate_is_unitary = is_scalar_matrix ( ( Dagger ( lr_gate ) , lr_gate ) , _get_min_qubits ( lr_gate ) , True ) if ( ( len ( left ) > 0 ) and lr_gate_is_unitary ) : new_left = left [ 0 : ( len ( left ) - 1 ) ] new_right = ( right + ( Dagger ( lr_gate ) , ) ) return ( new_left , new_right ) return None
perform a lr operation .