def _random_state(state=None):
 if types.is_integer(state):
  return np.random.RandomState(state)
 elif isinstance(state, np.random.RandomState):
  return state
 elif (state is None):
  return np.random
 else:
  raise ValueError('random_state must be an integer, a numpy RandomState, or None')

def _random_state ( state = None ) : if types . is_integer ( state ) : return np . random . RandomState ( state ) elif isinstance ( state , np . random . RandomState ) : return state elif ( state is None ) : return np . random else : raise ValueError ( 'random_state must be an integer, a numpy RandomState, or None' )
helper function for processing random_state arguments .