def _parse_dist_kw(dist, enforce_subclass=True):
 if isinstance(dist, rv_generic):
  pass
 elif isinstance(dist, string_types):
  try:
   dist = getattr(distributions, dist)
  except AttributeError:
   raise ValueError(('%s is not a valid distribution name' % dist))
 elif enforce_subclass:
  msg = '`dist` should be a stats.distributions instance or a string with the name of such a distribution.'
  raise ValueError(msg)
 return dist

def _parse_dist_kw ( dist , enforce_subclass = True ) : if isinstance ( dist , rv_generic ) : pass elif isinstance ( dist , string_types ) : try : dist = getattr ( distributions , dist ) except AttributeError : raise ValueError ( ( '%s is not a valid distribution name' % dist ) ) elif enforce_subclass : msg = '`dist` should be a stats.distributions instance or a string with the name of such a distribution.' raise ValueError ( msg ) return dist
parse dist keyword .