def zeros_like(self): return {k : zeros_like(v) for k, v in iteritems(getval(self))}
def list_untake(x, idx, template): result = list(zeros_like(template)) result[idx] = x return result
def tuple_untake(x, idx, template): result = list(zeros_like(template)) result[idx] = x return tuple(result)
def zeros_like(value): return [zeros_like(item) for item in getval(value)]
def dict_untake(x, idx, template): result = dict(zeros_like(template)) result[idx] = x return result