def red_dim(self, array):
while isinstance(array, list) == True orisinstance(array, np.ndarray) == True:<EOL><INDENT>try:<EOL><INDENT>if len(array) == <NUM_LIT:1>:<EOL><INDENT>array = array[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>except:<EOL><INDENT>break<EOL><DEDENT><DEDENT>return array<EOL>
This function reduces the dimensions of an array until it is
no longer of length 1.