'Register the client to the SAMP Hub.'

def register(self):

    if self.hub.is_connected:
        if (self._private_key is not None):
            raise SAMPClientError(u'Client    already    registered')
        result = self.hub.register(self.hub.lockfile[u'samp.secret'])
        if (result[u'samp.self-id'] == u''):
            raise SAMPClientError(u'Registration    failed    -    samp.self-id    was    not    set    by    the    hub.')
        if (result[u'samp.private-key'] == u''):
            raise SAMPClientError(u'Registration    failed    -    samp.private-key    was    not    set    by    the    hub.')
        self._public_id = result[u'samp.self-id']
        self._private_key = result[u'samp.private-key']
        self._hub_id = result[u'samp.hub-id']
        if self._callable:
            self._set_xmlrpc_callback()
            self._declare_subscriptions()
        if (self._metadata != {}):
            self.declare_metadata()
        self._is_registered = True
    else:
        raise SAMPClientError(u'Unable    to    register    to    the    SAMP    Hub.    Hub    proxy    not    connected.')
