def i2m(self, pkt, x): cls = self.subtypes_dict.get(pkt.subtype, StrLenField) try: return (cls.i2m.__func__ if six.PY2 else cls.i2m)(self, pkt, x) except Exception: log_runtime.exception("Failed to build " + self.name + " ! ") return StrLenField.i2m(self, pkt, x)
def i2m(self, pkt, i): cls = self.get_class(pkt) if cls is not None: return str(i) else: return StrLenField.i2m(self, pkt, i)