'Get all of the relevant fields of this model into a single string (self._hashable_representation()),
then sign it with the specified device (if specified), or the current device.'

def sign(self, device=None):

    device = (device or _get_own_device())
    assert device.get_key(), ('Cannot    sign    with    device    %s:    key    does    not    exist.' % (device.name or ''))
    self.set_id()
    self.signed_by = device
    self.full_clean()
    self.signature = self.signed_by.get_key().sign(self._hashable_representation())
