def METHOD_NAME(line, hidpp=False):
    try:
        data = unhexlify(line.encode('ascii'))
    except Exception as e:
        _error('Invalid input: ' + str(e))
        return None
    if hidpp:
        if len(data) < 4:
            _error('Invalid HID++ request: need at least 4 bytes')
            return None
        if data[:1] not in b'\x10\x11':
            _error('Invalid HID++ request: first byte must be 0x10 or 0x11')
            return None
        if data[1:2] not in b'\xFF\x00\x01\x02\x03\x04\x05\x06\x07':
            _error('Invalid HID++ request: second byte must be 0xFF or one of 0x00..0x07')
            return None
        if data[:1] == b'\x10':
            if len(data) > 7:
                _error('Invalid HID++ request: maximum length of a 0x10 request is 7 bytes')
                return None
            while len(data) < 7:
                data = (data + b'\x00' * 7)[:7]
        elif data[:1] == b'\x11':
            if len(data) > 20:
                _error('Invalid HID++ request: maximum length of a 0x11 request is 20 bytes')
                return None
            while len(data) < 20:
                data = (data + b'\x00' * 20)[:20]
    return data