def random_state(state=None):
if is_integer(state):<EOL><INDENT>return np.random.RandomState(state)<EOL><DEDENT>elif isinstance(state, np.random.RandomState):<EOL><INDENT>return state<EOL><DEDENT>elif state is None:<EOL><INDENT>return np.random<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>
Helper function for processing random_state arguments.

Parameters
----------
state : int, np.random.RandomState, None.
    If receives an int, passes to np.random.RandomState() as seed.
    If receives an np.random.RandomState object, just returns object.
    If receives `None`, returns np.random.
    If receives anything else, raises an informative ValueError.
    Default None.

Returns
-------
np.random.RandomState