'Register the client to the SAMP Hub.'

def register(self):

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