parameters: (orientation)
docstring: Checks an orientation string to ensure it is valid, meaning that all axes are represented
      exactly once and no invalid characters are present. Throws `ValueError` if orientation
      is invalid.
docstring_summary: Checks an orientation string to ensure it is valid, meaning that all axes are represented
      exactly once and no invalid characters are present. Throws `ValueError` if orientation
      is invalid.
docstring_tokens: Checks an orientation string to ensure it is valid meaning that all axes are represented exactly once and no invalid characters are present . Throws ValueError if orientation is invalid .
function: def check_orientation(orientation):
      """
      Checks an orientation string to ensure it is valid, meaning that all axes are represented
      exactly once and no invalid characters are present. Throws `ValueError` if orientation
      is invalid.
      """
      orientation = orientation.upper()
  
      if len(orientation) != 3:
          raise ValueError('Bad orientation: expected 3 characters, got %d.' % len(orientation))
  
      axes = ['LR', 'PA', 'IS']
      rs = np.zeros(3, dtype='int')
      for c in orientation:
          r = [c in axis for axis in axes]
          if not any(r):
              raise ValueError('Bad orientation: unknown character "%s".' % c)
          rs += r
  
      for i in range(3):
          if rs[i] > 1:
              raise ValueError('Bad orientation: %s axis represented multiple times.' % axes[i])
          if rs[i] == 0:
              raise ValueError('Bad orientation: %s axis not represented.' % axes[i])
function_tokens: def check_orientation ( orientation ) : orientation = orientation . upper ( ) if len ( orientation ) != 3 : raise ValueError ( 'Bad orientation: expected 3 characters, got %d.' % len ( orientation ) ) axes = [ 'LR' , 'PA' , 'IS' ] rs = np . zeros ( 3 , dtype = 'int' ) for c in orientation : r = [ c in axis for axis in axes ] if not any ( r ) : raise ValueError ( 'Bad orientation: unknown character "%s".' % c ) rs += r for i in range ( 3 ) : if rs [ i ] > 1 : raise ValueError ( 'Bad orientation: %s axis represented multiple times.' % axes [ i ] ) if rs [ i ] == 0 : raise ValueError ( 'Bad orientation: %s axis not represented.' % axes [ i ] )