def is_response(self): """Return True if this is a response PDU, False otherwise""" import command if command.get_command_code(self.command) & 0x80000000: return True return False
def generate(self): """Generate raw PDU""" body = self.generate_params() self._length = len(body) + 16 import command command_code = command.get_command_code(self.command) header = struct.pack(">LLLL", self._length, command_code, self.status, self.sequence) return header + body