def get_connection_distance(relationship, obj1, obj2, limit=2):
    """
    Calculates the distance between the two given objects for the given
    relationship. See `connections.models.Relationship` for more info.
    
        {% get_connection_distance 'relationship_name' obj1 obj2 as distance %}
        {% get_connection_distance 'relationship_name' obj1 obj2 limit=3 as distance %}
    
    """
    return get_relationship(relationship).distance_between(obj1, obj2, limit)