def add_session(self, session):
    if (self.length < 140):
        assigned = [id for tweet in self.get_sequence() for id in tweet.get_session_ids()]
        if (session.id in assigned):
            raise AlreadyAssignedError()
        locally_assigned = self.get_session_ids()
        locally_assigned.append(session.id)
        self.session_ids = ','.join([str(id) for id in locally_assigned])
        self.touch()
        if (self.length > 140):
            if (self.sessions.count() > 1):
                self.remove_session(session)
                raise TweetTooLongError()
    else:
        raise TweetTooLongError()
def add_session(self, session):
    if (self.length < 140):
        assigned = [id for tweet in self.get_sequence() for id in tweet.get_session_ids()]
        if (session.id in assigned):
            raise AlreadyAssignedError()
        locally_assigned = self.get_session_ids()
        locally_assigned.append(session.id)
        self.session_ids = ','.join([str(id) for id in locally_assigned])
        self.touch()
        if (self.length > 140):
            if (self.sessions.count() > 1):
                self.remove_session(session)
                raise TweetTooLongError()
    else:
        raise TweetTooLongError()