def _describe_cert(index, last_index, end_entity_name_override):
    """
    :param index:
        An integer of the index of the certificate in the path

    :param last_index:
        An integer of the last index in the path

    :param end_entity_name_override:
        None or a unicode string of the name to use for the final certificate
        in the path. Used for indirect CRL issuer and OCSP responder
        certificates.

    :return:
        A unicode string describing the position of a certificate in the chain
    """

    def _describe(definite=False):
        if index != last_index:
            return 'intermediate certificate %s' % index

        prefix = 'the ' if definite else ''

        if end_entity_name_override is not None:
            return prefix + end_entity_name_override

        return prefix + 'end-entity certificate'
    return _describe