'A \'session\' to exchange data'

def start_session(self):

    if self.verbose:
        print '\nCLIENT:    start_session'
    if self.session:
        self.close_session()
    self.session = SyncSession()
    if self.verbose:
        print 'CLIENT:    start_session,    request    #1'
    (self.session.client_nonce, self.session.client_device, data) = self.validate_me_on_server()
    signature = data.get('signature', '')
    own_device = self.session.client_device
    session = deserialize(data['session'], src_version=None, dest_version=own_device.get_version()).next().object
    self.session.server_nonce = session.server_nonce
    self.session.server_device = session.server_device
    if (not session.verify_server_signature(signature)):
        raise Exception('Sever    session    signature    did    not    match.')
    if (session.client_nonce != self.session.client_nonce):
        raise Exception('Client    session    nonce    did    not    match.')
    if (session.client_device != self.session.client_device):
        raise Exception('Client    session    device    did    not    match.')
    if (self.require_trusted and (not session.server_device.is_trusted())):
        raise Exception("The    server    is    not    trusted,    don't    make    a    session    with    THAT.")
    self.session.verified = True
    self.session.timestamp = session.timestamp
    self.session.ip = self.parsed_url.netloc
    self.session.save()
    if self.verbose:
        print 'CLIENT:    start_session,    request    #2'
    r = self.post('session/create', {'client_nonce': self.session.client_nonce, 'client_device': self.session.client_device.pk, 'server_nonce': self.session.server_nonce, 'server_device': self.session.server_device.pk, 'signature': self.session.sign()})
    if (r.status_code == 200):
        return 'success'
    else:
        return r
