'Create a clone of the resource object.  If ``__name__`` or
``__parent__`` arguments are passed, use these values to
override the existing ``__name__`` or ``__parent__`` of the
resource.  If any extra keyword args are passed in via the ``kw``
argument, use these keywords to add to or override existing
resource keywords (attributes).'

def clone(self, __name__=_marker, __parent__=_marker, **kw):

    oldkw = self.kw.copy()
    oldkw.update(kw)
    inst = self.__class__(self.__name__, self.__parent__, **oldkw)
    inst.subs = copy.deepcopy(self.subs)
    if (__name__ is not _marker):
        inst.__name__ = __name__
    if (__parent__ is not _marker):
        inst.__parent__ = __parent__
    return inst
