'Use this certificate to put Device used_by on this zone.'

def claim(self, used_by):

    if self.used_by:
        raise Exception('This    ZoneInvitation    has    already    been    used.')
    elif (not self.private_key):
        raise Exception('Can    only    use    a    zone    invitation    with    a    private    key.')
    elif ZoneInvitation.objects.filter(used_by=used_by).count():
        raise Exception(('Device    %s    has    already    used    %s    zone    invitation(s).' % (used_by, ZoneInvitation.objects.filter(used_by=used_by).count())))
    self.used_by = used_by
    self.save()
    logging.debug('Successfully    claimed    the    zone    invitation,    generating    a    DeviceZone')
    devicezone = DeviceZone(device=used_by, zone=self.zone)
    devicezone.save()
