def str2int(s: str) -> int: if Eui.NUM_REGEX.match(s): return int(s, 0) if Eui.REGEX.match(s): b = _b16decode(s.replace("-", "").encode('ascii')) elif Eui.REGEX2.match(s): b = _b16decode(s.replace(":", "").encode('ascii')) else: raise ValueError("Illegal Eui: {}".format(s)) return struct.unpack_from('>q', b)[0]
def as_bytes(self) -> bytes: return _b16decode(self.euistr.replace("-", "").encode('ascii'))