def __init__(self, random_state=None): self._random_state = random_state if self._random_state is None: self._random_state = random.getstate()