'Create an object that represents a SAML Subject.
<ns0:Subject>
<ns0:NameID>
john@smith.com</ns0:NameID>
<ns0:SubjectConfirmation
Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<ns0:SubjectConfirmationData
NotOnOrAfter="2014-08-19T11:53:57.243106Z"
Recipient="http://beta.com/Shibboleth.sso/SAML2/POST" />
</ns0:SubjectConfirmation>
</ns0:Subject>
:returns: XML <Subject> object'

def _create_subject(self, user, expiration_time, recipient):

    name_id = saml.NameID()
    name_id.set_text(user)
    subject_conf_data = saml.SubjectConfirmationData()
    subject_conf_data.recipient = recipient
    subject_conf_data.not_on_or_after = expiration_time
    subject_conf = saml.SubjectConfirmation()
    subject_conf.method = saml.SCM_BEARER
    subject_conf.subject_confirmation_data = subject_conf_data
    subject = saml.Subject()
    subject.subject_confirmation = subject_conf
    subject.name_id = name_id
    return subject
