Use the magic of a unicorn and summon the set-top box to listen
        to us.

                            /
                       ,.. /
                     ,'   ';
          ,,.__    _,' /';  .
         :','  ~~~~    '. '~
        :' (   )         )::,
        '. '. .=----=..-~  .;'
         '  ;'  ::   ':.  '"
           (:   ':    ;)
            \\   '"  ./
             '"      '"

        Seriously, I've no idea what I'm doing here.

def authorize(self):
        """ Use the magic of a unicorn and summon the set-top box to listen
        to us.

                            /
                       ,.. /
                     ,'   ';
          ,,.__    _,' /';  .
         :','  ~~~~    '. '~
        :' (   )         )::,
        '. '. .=----=..-~  .;'
         '  ;'  ::   ':.  '"
           (:   ':    ;)
            \\   '"  ./
             '"      '"

        Seriously, I've no idea what I'm doing here.
        """
        # Read the version of the set-top box and write it back. Why? I've no
        # idea.
        version = self.con.makefile().readline()
        self.con.send(version.encode())

        # The set-top box returns with 2 bytes. I've no idea what they mean.
        self.con.recv(2)

        # The following reads and writes are used to authenticate. But I don't
        # fully understand what is going on.
        self.con.send(struct.pack('>B', 1))
        msg = self.con.recv(4)
        response = struct.unpack(">I", msg)

        if response[0] != 0:
            log.debug("Failed to authorize with set-top at %s:%s.",
                      self.ip, self.port)
            raise AuthenticationError()

        # Dunno where this is good for. But otherwise the client doesn't work.
        self.con.send(b'0')
        log.debug('Authorized succesfully with set-top box at %s:%s.',
                  self.ip, self.port)