code: def _create_hexdump(src, start_offset=0, length=16):
          
          FILTER = "".join((len(repr(chr(x))) == 3) and chr(x) or "." for x in range(256))
          pattern = "{{0:04X}}   {{1:<{0}}}  {{2}}\n".format(length * 3)
  
          # Convert raw data to str (Python 3 compatibility)
          src = to_str(src, "latin-1")
  
          result = []
          for i in range(0, len(src), length):
              s = src[i : i + length]
              hexa = " ".join("{0:02X}".format(ord(x)) for x in s)
              printable = s.translate(FILTER)
              result.append(pattern.format(i + start_offset, hexa, printable))
  
          return "".join(result)
docs: Prepares an hexadecimal dump string
  
          :param src: A string containing binary data
          :param start_offset: The start offset of the source
          :param length: Length of a dump line
          :return: A dump string