in mujoco_worldgen/objs/obj.py [0:0]
def add_transform(self, transform):
'''
Transforms are functions which are called on the XML dictionary
produced by to_xml() before returning to the parent. This happens
in a recursive context, so it has access to all children, but not any
of the parents.
Because the XML dictionaries are mutable, the functions should modify
the dictionary in place, and not return anything.
The format of the dictionary matches that of xmltodict.
'''
assert hasattr(transform, "__call__"), \
"Argument to add_transform should be a function"
assert len(inspect.getargspec(transform).args) == 1, \
"transform function should take a single argument " + \
"of a type OrderedDict. This argument represents " + \
"xml to be transformed."
self.transforms.append(transform)
return self