def unmarshall(self, types, strict=True):
        #import pdb; pdb.set_trace()

        """Convert to python values the current serialized xml element"""
        # types is a dict of {tag name: convertion function}
        # strict=False to use default type conversion if not specified
        # example: types={'p': {'a': int,'b': int}, 'c': [{'d':str}]}
        #   expected xml: <p><a>1</a><b>2</b></p><c><d>hola</d><d>chau</d>
        #   returnde value: {'p': {'a':1,'b':2}, `'c':[{'d':'hola'},{'d':'chau'}]}
        d = {}
        for node in self():
            name = str(node.get_local_name())
            ref_name_type = None
            # handle multirefs: href="#id0"
            if 'href' in node.attributes().keys():
                href = node['href'][1:]
                for ref_node in self(root=True)("multiRef"):
                    if ref_node['id'] == href:
                        node = ref_node
                        ref_name_type = ref_node['xsi:type'].split(":")[1]
                        break             

            try:
                if isinstance(types, dict):
                    fn = types[name]
                    # custom array only in the response (not defined in the WSDL):
                    # <results soapenc:arrayType="xsd:string[199]>
                    if any([k for k,v in node[:] if 'arrayType' in k]) and not isinstance(fn, list):
                        fn = [fn]
                else:
                    fn = types
            except (KeyError, ) as e:
                if 'xsi:type' in node.attributes().keys():
                    xsd_type = node['xsi:type'].split(":")[1]
                    try:
                        fn = REVERSE_TYPE_MAP[xsd_type]
                    except:
                        fn = None  # ignore multirefs!
                elif strict:
                    raise TypeError("Tag: %s invalid (type not found)" % (name,))
                else:
                    # if not strict, use default type conversion
                    fn = str

            if isinstance(fn, list):
                # append to existing list (if any) - unnested dict arrays -
                value = d.setdefault(name, [])
                children = node.children()
                # TODO: check if this was really needed (get first child only)
                ##if len(fn[0]) == 1 and children:
                ##    children = children()
                if fn and not isinstance(fn[0], dict):
                    # simple arrays []
                    for child in (children or []):
                        tmp_dict = child.unmarshall(fn[0], strict)
                        value.extend(tmp_dict.values())
                elif (self.__jetty and len(fn[0]) > 1):
                    # Jetty array style support [{k, v}]
                    for parent in node:
                        tmp_dict = {}    # unmarshall each value & mix
                        for child in (node.children() or []):
                            tmp_dict.update(child.unmarshall(fn[0], strict))
                        value.append(tmp_dict)
                else:  # .Net / Java
                    for child in (children or []):
                        value.append(child.unmarshall(fn[0], strict))

            elif isinstance(fn, tuple):
                value = []
                _d = {}
                children = node.children()
                as_dict = len(fn) == 1 and isinstance(fn[0], dict)

                for child in (children and children() or []):  # Readability counts
                    if as_dict:
                        _d.update(child.unmarshall(fn[0], strict))  # Merging pairs
                    else:
                        value.append(child.unmarshall(fn[0], strict))
                if as_dict:
                    value.append(_d)

                if d in name:
                    _tmp = list(d[name])
                    _tmp.extend(value)
                    value = tuple(_tmp)
                else:
                    value = tuple(value)

            elif isinstance(fn, dict):
                ##if ref_name_type is not None:
                ##    fn = fn[ref_name_type]
                children = node.children()
                value = children and children.unmarshall(fn, strict)
            else:
                if fn is None:  # xsd:anyType not unmarshalled
                    value = node
                elif unicode(node) or (fn == str and unicode(node) != ''):
                    try:
                        # get special deserialization function (if any)
                        fn = TYPE_UNMARSHAL_FN.get(fn, fn)
                        if fn == str:
                            # always return an unicode object:
                            # (avoid encoding errors in py<3!)
                            value = unicode(node)
                        else:
                            value = fn(unicode(node))
                    except (ValueError, TypeError) as e:
                        raise ValueError("Tag: %s: %s" % (name, e))
                else:
                    value = None
            d[name] = value
        return d
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pysimplesoap/simplexml.py/SimpleXMLElement.unmarshall/swapped operands of `in`