def decode_hex(string):
    """
    Decode hexdump string

    *string* must be an ASCII string describing binary data as
    hexadecimal bytes, ie. each line must have this form:

          BYTE [BYTE]..

    where each BYTE is a two-digit hexadecimal number.  Lines
    are joined before decoding.

    For example:

        >>> decode_hex('aa bb\ncc')
        b'\xaa\xbb\xcc'

    describes binary blob containing  three bytes: AA, BB and CC.
    """
    hexstr = ''
    for line in string.split('\n'):
        hexstr += ''.join(line.split())
    return bytes.fromhex(hexstr)