<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def robust_init(stochclass, tries, *args, **kwds):
 """Robust initialization of a Stochastic. If the evaluation of the log-probability returns a ZeroProbability error, due for example to a parent being outside of the support for this Stochastic, the values of parents are randomly sampled until a valid log-probability is obtained. If the log-probability is still not valid after `tries` attempts, the original ZeroProbability error is raised. :Parameters: The Stochastic distribution to instantiate. tries : int Maximum number of times parents will be sampled. *args, **kwds Positional and keyword arguments to declare the Stochastic variable. :Example: """

    # Find the direct parents
    stochs = [arg for arg in (list(args) + list(kwds.values()))
              if isinstance(arg.__class__, StochasticMeta)]

    # Find the extended parents
    parents = stochs
    for s in stochs:
        parents.extend(s.extended_parents)

    extended_parents = set(parents)

    # Select the parents with a random method.
    random_parents = [
        p for p in extended_parents if p.rseed is True and hasattr(
            p,
            'random')]

    for i in range(tries):
        try:
            return stochclass(*args, **kwds)
        except ZeroProbability:
            exc = sys.exc_info()
            for parent in random_parents:
                try:
                    parent.random()
                except:
                    six.reraise(*exc)

    six.reraise(*exc)