'The assertion must contain a Subject'

def get_subject(self):

    assert self.assertion.subject
    subject = self.assertion.subject
    subjconf = []
    for subject_confirmation in subject.subject_confirmation:
        _data = subject_confirmation.subject_confirmation_data
        if (subject_confirmation.method == SCM_BEARER):
            if (not self._bearer_confirmed(_data)):
                continue
        elif (subject_confirmation.method == SCM_HOLDER_OF_KEY):
            if (not self._holder_of_key_confirmed(_data)):
                continue
        elif (subject_confirmation.method == SCM_SENDER_VOUCHES):
            pass
        else:
            raise ValueError(('Unknown    subject    confirmation    method:    %s' % (subject_confirmation.method,)))
        subjconf.append(subject_confirmation)
    if (not subjconf):
        raise VerificationError('No    valid    subject    confirmation')
    subject.subject_confirmation = subjconf
    try:
        assert subject.name_id
        self.name_id = subject.name_id
    except AssertionError:
        if subject.encrypted_id:
            _name_id_str = self.sec.decrypt(subject.encrypted_id.encrypted_data.to_string())
            _name_id = saml.name_id_from_string(_name_id_str)
            self.name_id = _name_id
        else:
            raise VerificationError('Missing    NameID')
    logger.info(('Subject    NameID:    %s' % self.name_id))
    return self.name_id
