code: def read_packet(self):
          
  
          packet = ffi.new("RTMPPacket*")
          packet_complete = False
  
          while not packet_complete:
              res = librtmp.RTMP_ReadPacket(self.rtmp, packet)
  
              if res < 1:
                  if librtmp.RTMP_IsTimedout(self.rtmp):
                      raise RTMPTimeoutError("Timed out while reading packet")
                  else:
                      raise RTMPError("Failed to read packet")
  
              packet_complete = packet.m_nBytesRead == packet.m_nBodySize
  
          return RTMPPacket._from_pointer(packet)
docs: Reads a RTMP packet from the server.
  
          Returns a :class:`RTMPPacket`.
  
          Raises :exc:`RTMPError` on error.
          Raises :exc:`RTMPTimeoutError` on timeout.
  
          Usage::
  
            >>> packet = conn.read_packet()
            >>> packet.body
            b'packet body ...'