'Register this device with a zone.  There are two methods:
1.register_prove_self_registration:
We joined a zone while offline, during install--either by
using pre-packaged zone information, or generating our own
zone.  In this case, we have to prove our permission to be
on the zone.
2. register_via_preregistered_key (deprecated):
We have no zone information; instead, we connect with the
central server directly, and get zone information from
there.  This requires a previous manual step, where the
public key of this device has been registered to be accepted
onto that zone.'

def register(self, prove_self=False):

    try:
        models = self.register_via_preregistered_key()
    except Exception as e:
        try:
            return json.loads(e.args[0])
        except:
            return {'code': 'unexpected_exception', 'error': e.args[0]}
    for model in models:
        if (not model.object.verify()):
            logging.warn(('\n\n\nFailed    to    verify    model:    %s!\n\n\n' % unicode(model.object)))
        if isinstance(model.object, Device):
            model.object.save(is_trusted=True, imported=True, increment_counters=False)
        else:
            model.object.save(imported=True, increment_counters=False)
    return {'code': 'registered'}
