code: def setdefault(elt, key, default, ctx=None):
      
  
      result = default
  
      # get the best context
      if ctx is None:
          ctx = find_ctx(elt=elt)
  
      # get elt properties
      elt_properties = _ctx_elt_properties(elt=elt, ctx=ctx, create=True)
  
      # if key exists in elt properties
      if key in elt_properties:
          # result is elt_properties[key]
          result = elt_properties[key]
      else:  # set default property value
          elt_properties[key] = default
  
      return result
docs: Get a local property and create default value if local property does not
          exist.
  
      :param elt: local proprety elt to get/create. Not None methods.
      :param str key: proprety name.
      :param default: property value to set if key no in local properties.
  
      :return: property value or default if property does not exist.