def _bytes_as_hex_str(cls, b): b_as_hex = codecs.getencoder('hex_codec')(b)[0] b_as_hex_str = b_as_hex.decode(cls.DNS_CTYPE) return b_as_hex_str