def get_review_permalink(review, anchor_pattern=None):
    """
    Get the permalink for a review, optionally specifying the format of the
    named anchor to be appended to the end of the URL.

    Example::
        {% get_review_permalink review "#r%(id)s-by-%(user_name)s" %}
    """

    if anchor_pattern:
        return review.get_absolute_url(anchor_pattern)
    return review.get_absolute_url()