<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dump_hex(ofd, start, len_, prefix=0):
 """Convert `start` to hex and logs it, 16 bytes per log statement. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L760 Positional arguments: ofd -- function to call with arguments similar to `logging.debug`. start -- bytearray() or bytearray_ptr() instance. len_ -- size of `start` (integer). Keyword arguments: prefix -- additional number of whitespace pairs to prefix each log statement with. """

    prefix_whitespaces = '  ' * prefix
    limit = 16 - (prefix * 2)
    start_ = start[:len_]
    for line in (start_[i:i + limit] for i in range(0, len(start_), limit)):  # stackoverflow.com/a/9475354/1198943
        hex_lines, ascii_lines = list(), list()
        for c in line:
            hex_lines.append('{0:02x}'.format(c if hasattr(c, 'real') else ord(c)))
            c2 = chr(c) if hasattr(c, 'real') else c
            ascii_lines.append(c2 if c2 in string.printable[:95] else '.')
        hex_line = ' '.join(hex_lines).ljust(limit * 3)
        ascii_line = ''.join(ascii_lines)
        ofd('    %s%s%s', prefix_whitespaces, hex_line, ascii_line)