'Make association requests to the server, attempting to
create a new association.
@returns: a new association object
@rtype: L{openid.association.Association}'

def _negotiateAssociation(self, endpoint):

    (assoc_type, session_type) = self.negotiator.getAllowedType()
    try:
        assoc = self._requestAssociation(endpoint, assoc_type, session_type)
    except ServerError as why:
        supportedTypes = self._extractSupportedAssociationType(why, endpoint, assoc_type)
        if (supportedTypes is not None):
            (assoc_type, session_type) = supportedTypes
            try:
                assoc = self._requestAssociation(endpoint, assoc_type, session_type)
            except ServerError as why:
                oidutil.log(('Server    %s    refused    its    suggested    association    type:    session_type=%s,    assoc_type=%s' % (endpoint.server_url, session_type, assoc_type)))
                return None
            else:
                return assoc
    else:
        return assoc
