need to clone both the enclosed object + the wrapping asset
323018
def clone_to(self, target_catalog):
        """"""
        def _clone(obj_id):
            package_name = obj_id.get_identifier_namespace().split('.')[0]
            obj_name = obj_id.get_identifier_namespace().split('.')[1].lower()

            catalogs = {
                'assessment': 'bank',
                'repository': 'repository'
            }

            my_catalog_name = catalogs[package_name.lower()]

            mgr = self.my_osid_object._get_provider_manager(package_name.upper())

            if self.my_osid_object._proxy is not None:
                catalog_lookup_session = getattr(mgr, 'get_' + my_catalog_name + '_lookup_session')(
                    proxy=self.my_osid_object._proxy
                )
            else:
                catalog_lookup_session = getattr(mgr, 'get_' + my_catalog_name + '_lookup_session')()

            catalog = getattr(catalog_lookup_session, 'get_' + my_catalog_name)(target_catalog.ident)

            if self.my_osid_object._proxy is not None:
                admin_session = getattr(mgr, 'get_' + obj_name + '_admin_session_for_' + my_catalog_name)(
                    catalog.ident,
                    proxy=self.my_osid_object._proxy
                )
            else:
                admin_session = getattr(mgr, 'get_' + obj_name + '_admin_session_for_' + my_catalog_name)(catalog.ident)

            new_obj = getattr(admin_session, 'duplicate_' + obj_name)(obj_id)
            try:
                form = getattr(admin_session, 'get_' + obj_name + '_form_for_update')(new_obj.ident)
                form.set_provenance(str(obj_id))
                new_obj = getattr(admin_session, 'update_' + obj_name)(form)
            except AttributeError:
                pass
            return new_obj

        enclosed_object_id = self.get_enclosed_object_id()
        new_enclosed_object = _clone(enclosed_object_id)

        # Let's do the asset here
        enclosure_id = self.my_osid_object.ident
        new_asset = _clone(enclosure_id)
        package_name = enclosure_id.get_identifier_namespace().split('.')[0]
        obj_name = enclosure_id.get_identifier_namespace().split('.')[1].lower()

        catalogs = {
            'assessment': 'bank',
            'repository': 'repository'
        }

        my_catalog_name = catalogs[package_name.lower()]

        mgr = self.my_osid_object._get_provider_manager(package_name.upper())

        if self.my_osid_object._proxy is not None:
            catalog_lookup_session = getattr(mgr, 'get_' + my_catalog_name + '_lookup_session')(
                proxy=self.my_osid_object._proxy
            )
        else:
            catalog_lookup_session = getattr(mgr, 'get_' + my_catalog_name + '_lookup_session')()
        catalog = getattr(catalog_lookup_session, 'get_' + my_catalog_name)(target_catalog.ident)

        if self.my_osid_object._proxy is not None:
            admin_session = getattr(mgr, 'get_' + obj_name + '_admin_session_for_' + my_catalog_name)(
                catalog.ident,
                proxy=self.my_osid_object._proxy
            )
        else:
            admin_session = getattr(mgr, 'get_' + obj_name + '_admin_session_for_' + my_catalog_name)(catalog.ident)

        form = getattr(admin_session, 'get_' + obj_name + '_form_for_update')(new_asset.ident)
        form.set_enclosed_object(new_enclosed_object.ident)
        return getattr(admin_session, 'update_' + obj_name)(form)
207300
function fixClonedDom(clone, source) {
      // do nothing if cloned node is not an element
      if (!source.querySelectorAll) return;
      // these two lists should be coincident
      var s$ = QSA(source, TEMPLATE_TAG);
      if (s$.length === 0) {
        return;
      }
      var t$ = QSA(clone, TEMPLATE_TAG);
      for (var i=0, l=t$.length, t, s; i<l; i++) {
        s = s$[i];
        t = t$[i];
        if (PolyfilledHTMLTemplateElement && PolyfilledHTMLTemplateElement.decorate) {
          PolyfilledHTMLTemplateElement.decorate(s);
        }
        capturedReplaceChild.call(t.parentNode, cloneNode.call(s, true), t);
      }
    }
1162190
function (options) {
                    var ret = {};
                    options = options || {};

                    for (var key in this.$) {
                        if (this.$.hasOwnProperty(key)) {
                            if (options.exclude) {
                                if (options.exclude instanceof Array) {
                                    if (_.include(options.exclude, key)) {
                                        ret[key] = this.$[key];
                                        continue;
                                    }
                                }
                            }
                            if (this.$bindings.hasOwnProperty(key) && this.factory.prototype.defaults.hasOwnProperty(key)) {
                                ret[key] = this.factory.prototype.defaults[key];
                            } else {
                                ret[key] = this._cloneAttribute(this.$[key], key);
                            }

                        }
                    }
                    var b = new this.factory(ret, true);
                    b._$source = this;
                    b.$injected = this.$injected;
                    return b;
                }
420302
function _clone(src) {
  if (!src) {
    return src;
  }

  if (typeof src.clone === 'function') {
    return src.clone();
  } else if (_isPlainObject(src) || _isArray(src)) {
    let ret = new (src.constructor);

    Object.getOwnPropertyNames(src).forEach(function(key) {
      if (typeof src[key] !== 'function') {
        ret[key] = _clone(src[key]);
      }
    });

    return ret;
  } else {
    return JSON.parse(JSON.stringify(src));
  }
}
1320810
function wrap(fn, args, key) {
    const self = this;

    if (key === undefined && typeof(args) === 'string') {
      key = args;
      args = [];
    }
    if (!args) args = [];

    return function wrapper(context, cb) {
      const copyArgs = args.slice(args);
      copyArgs.unshift(self);
      copyArgs.push(onWrappedDone);
      return fn.bind.apply(fn, copyArgs)();

      function onWrappedDone(err, result) {
        if (err) return cb(err);

        if (key) context[key] = result;
        return cb(null);
      }
    };
  }
42299
function clone (data) {
  if (Array.isArray(data)) {
    return data.map(clone)
  } else if (data && typeof data === 'object') {
    let obj = Object.assign({}, data)
    for (let key in obj) {
      if (!obj.hasOwnProperty(key)) continue
      if (typeof obj[key] === 'object') {
        obj[key] = clone(obj[key])
      }
    }
    return obj
  } else {
    return data
  }
}
635136
function Facade (obj) {
  obj = clone(obj);
  if (!obj.hasOwnProperty('timestamp')) obj.timestamp = new Date();
  else obj.timestamp = newDate(obj.timestamp);
  traverse(obj);
  this.obj = obj;
}
289213
function wrapInner(parent, wrapper) {
    if (typeof wrapper === "string") wrapper = document.createElement(wrapper);

    parent.appendChild(wrapper);

    while (parent.firstChild !== wrapper) wrapper.appendChild(parent.firstChild);
  }
1358969
function clone (obj, deep) {
  if (obj) {
    return deep ? deepClone(obj) : objectAssign(isPlainObject(obj) ? {} : [], obj)
  }
  return obj
}
917546
def clone_object(old_object)
      object = build_from(old_object)
      assign_attributes_for(object, get_model_attributes_from(old_object))

      object
    end
585183
function _clone(value) {
  if(value && typeof value === 'object') {
    var rval = Array.isArray(value) ? [] : {};
    for(var i in value) {
      rval[i] = _clone(value[i]);
    }
    return rval;
  }
  return value;
}
1228567
function cloneWithRaws(node) {
      if (node.nodes) {
        const oldNodes = node.nodes;
        node.nodes = [];
        const clone = node.clone({ raws: node.raws });
        node.nodes = oldNodes;
        for (const clonedChild of oldNodes.map(cloneWithRaws)) {
          clone.append(clonedChild);
        }
        return clone;
      } else {
        return node.clone({ raws: node.raws });
      }
    }
709945
function cloneObj(obj, exclude) {
  var type = _typeof(obj);

  switch (type) {
    case 'undefined':
    case 'boolean':
    case 'nuber':
    case 'string':
    case 'function':
      return obj;
      break;

    case 'object':
      if (obj === null) {
        // null is object
        return obj;
      }

      var r;

      if (isArray(obj)) {
        r = [];
        var _iteratorNormalCompletion3 = true;
        var _didIteratorError3 = false;
        var _iteratorError3 = undefined;

        try {
          for (var _iterator3 = obj[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
            var item = _step3.value;
            r.push(cloneObj(item, exclude));
          }
        } catch (err) {
          _didIteratorError3 = true;
          _iteratorError3 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
              _iterator3.return();
            }
          } finally {
            if (_didIteratorError3) {
              throw _iteratorError3;
            }
          }
        }
      } else {
        r = {};

        for (var _i7 = 0, _Object$keys2 = Object.keys(obj); _i7 < _Object$keys2.length; _i7++) {
          var key = _Object$keys2[_i7];

          if (!exclude || isArray(exclude) && !exclude.includes(key) || !exclude(key, obj[key], obj)) {
            r[key] = cloneObj(obj[key], exclude);
          }
        }
      }

      return r;
      break;

    default:
      return obj;
      break;
  }
}
491215
function wrap (factory, node, tag) {
    // If there is a previous node that is not text, insert a new line to
    // for 
    if (node.previousSibling != null && node.previousSibling.nodeType != 3) {
        var newline = factory.createTextNode("\n");
        body.insertBefore(newline, node);
    }
    var wrapper = factory.createElement(tag);
    node.parentNode.insertBefore(wrapper, node);
    wrapper.appendChild(node);
    return wrapper;
  }
80097
function clone(obj) {
  if (null == obj || "object" != typeof obj)
    return obj;

  if (obj instanceof Object) {
    var copy = {};
    for (var attr in obj) {
      if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
    }
    return copy;
  }

  throw new Error("Unable to copy obj! Its type isn't supported.");
}
1294754
function cloneSvg(src, attrs, styles) {
  var clonedSvg = src.cloneNode(true);

  domWalk(src, clonedSvg, function (src, tgt) {
    if (tgt.style) {
      (0, _computedStyles2['default'])(src, tgt.style, styles);
    }
  }, function (src, tgt) {
    if (tgt.style && tgt.parentNode) {
      cleanStyle(tgt);
    }
    if (tgt.attributes) {
      cleanAttrs(tgt, attrs, styles);
    }
  });

  return clonedSvg;
}
379255
function cloneIt2(o) {
	let keys = Object.keys(o);
	let current = o;
	const acc = {};
	let currentAcc = acc;

	let i = 0;
	let iMax = keys.length + 1;
	let previous = [];
	let activeKey = [];

	for (; i < iMax; i++) {
		if (i === iMax - 1) {
			if (!previous.length) {
				break;
			}

			const prev = previous.pop();
			activeKey.pop();

			i = prev.i;
			iMax = prev.iMax;
			keys = prev.keys;

			let j = 0;
			const jMax = activeKey.length;
			currentAcc = acc;
			current = o;

			for (; j < jMax; j++) {
				currentAcc = currentAcc[activeKey[j]];
				current = current[activeKey[j]];
			}
		} else if (typeof current[keys[i]] === 'object') {
			currentAcc[keys[i]] = {};

			previous.push({ i, iMax, keys });
			activeKey.push(keys[i]);
			current = current[keys[i]];
			currentAcc = currentAcc[keys[i]];
			i = -1;
			keys = Object.keys(current);
			iMax = keys.length + 1;
		} else {
			currentAcc[keys[i]] = current[keys[i]];
		}
	}

	return acc;
}