def interpretAsOpenMath(x):
if hasattr(x, "<STR_LIT>") and x._ishelper:<EOL><INDENT>return x._toOM()<EOL><DEDENT>elif isinstance(x, om.OMAny):<EOL><INDENT>return x<EOL><DEDENT>elif isinstance(x, six.integer_types):<EOL><INDENT>return om.OMInteger(x)<EOL><DEDENT>elif isinstance(x, float):<EOL><INDENT>return om.OMFloat(x)<EOL><DEDENT>elif isinstance(x, six.string_types):<EOL><INDENT>return om.OMString(x)<EOL><DEDENT>elif isinstance(x, WrappedHelper):<EOL><INDENT>return x.toOM()<EOL><DEDENT>elif inspect.isfunction(x):<EOL><INDENT>paramMap = inspect.signature(x).parameters<EOL>params = [v for k, v in six.iteritems(paramMap)]<EOL>posArgKinds = [inspect.Parameter.POSITIONAL_ONLY, inspect.Parameter.POSITIONAL_OR_KEYWORD]<EOL>if not all([p.kind in posArgKinds for p in params]):<EOL><INDENT>raise CannotInterpretAsOpenMath("<STR_LIT>")<EOL><DEDENT>paramsOM = [om.OMVariable(name=p.name) for p in params]<EOL>bodyOM = interpretAsOpenMath(x(*paramsOM))<EOL>return OMBinding(om.OMSymbol(name="<STR_LIT>", cd="<STR_LIT>", cdbase="<STR_LIT>"), paramsOM, bodyOM)<EOL><DEDENT>else:<EOL><INDENT>raise CannotInterpretAsOpenMath("<STR_LIT>" + str(x))<EOL><DEDENT>
tries to convert a Python object into an OpenMath object
    this is not a replacement for using a Converter for exporting Python objects
    instead, it is used conveniently building OM objects in DSL embedded in Python
    inparticular, it converts Python functions into OMBinding objects using lambdaOM as the binder