code: def observed(obj=None, **kwds):
      
  
      if obj is not None:
          if isinstance(obj, Stochastic):
              obj._observed = True
              return obj
          else:
              p = stochastic(__func__=obj, observed=True, **kwds)
              return p
  
      kwds['observed'] = True
  
      def instantiate_observed(func):
          return stochastic(func, **kwds)
  
      return instantiate_observed
docs: Decorator function to instantiate data objects.
      If given a Stochastic, sets a the observed flag to True.
  
      Can be used as
  
      @observed
      def A(value = ., parent_name = .,  ...):
          return foo(value, parent_name, ...)
  
      or as
  
      @stochastic(observed=True)
      def A(value = ., parent_name = .,  ...):
          return foo(value, parent_name, ...)
  
  
      :SeeAlso:
        stochastic, Stochastic, dtrm, Deterministic, potential, Potential, Model,
        distributions