def const_factory(value):
<EOL>assert not isinstance(value, NodeNG)<EOL>if isinstance(value, (list, set, tuple, dict)):<EOL><INDENT>elts = []<EOL><DEDENT>else:<EOL><INDENT>elts = value<EOL><DEDENT>try:<EOL><INDENT>initializer_cls = CONST_CLS[value.__class__]<EOL>initializer = _CONST_CLS_CONSTRUCTORS[initializer_cls]<EOL>return initializer(initializer_cls, elts)<EOL><DEDENT>except (KeyError, AttributeError):<EOL><INDENT>node = EmptyNode()<EOL>node.object = value<EOL>return node<EOL><DEDENT>
return an astroid node for a python value