<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def state_counts(self, variable, **kwargs):
 """ Return counts how often each state of 'variable' occured in the data. If the variable has parents, counting is done conditionally for each state configuration of the parents. Parameters variable: string Name of the variable for which the state count is to be done. complete_samples_only: bool Specifies how to deal with missing data, if present. If set to `True` all rows that contain `np.NaN` somewhere are ignored. If `False` then every row where neither the variable nor its parents are `np.NaN` is used. Desired default behavior can be passed to the class constructor. Returns ------- state_counts: pandas.DataFrame Table with state counts for 'variable' Examples -------- 'B': ['b1', 'b2', 'b1'], 'C': ['c1', 'c1', 'c2']}) A a1 2 a2 1 A a1 a2 B b1 b2 b1 b2 C c1 1 1 0 0 c2 0 0 1 0 """


        parents = sorted(self.model.get_parents(variable))
        return super(ParameterEstimator, self).state_counts(variable, parents=parents, **kwargs)