code: def hexdump(src, length=8, colorize=False):
      
      if not src:
          return str(src)
      if type(src) is not bytes:
          raise yubico_exception.InputError('Hexdump \'src\' must be bytestring (got %s)' % type(src))
      offset = 0
      result = ''
      for this in group(src, length):
          if colorize:
              last, this = this[-1], this[:-1]
              colors = DumpColors()
              color = colors.get('RESET')
              if ord_byte(last) & yubikey_defs.RESP_PENDING_FLAG:
                  # write to key
                  color = colors.get('BLUE')
              elif ord_byte(last) & yubikey_defs.SLOT_WRITE_FLAG:
                  color = colors.get('GREEN')
              hex_s = color + ' '.join(["%02x" % ord_byte(x) for x in this]) + colors.get('RESET')
              hex_s += " %02x" % ord_byte(last)
          else:
              hex_s = ' '.join(["%02x" % ord_byte(x) for x in this])
          result += "%04X   %s\n" % (offset, hex_s)
          offset += length
      return result
docs: Produce a string hexdump of src, for debug output.
  
      Input: bytestring; output: text string