def get_endpoint(brain_or_object, default=DEFAULT_ENDPOINT):
portal_type = get_portal_type(brain_or_object)<EOL>resource = portal_type_to_resource(portal_type)<EOL>endpoints = list(router.DefaultRouter.view_functions.keys())<EOL>if resource in endpoints:<EOL><INDENT>return resource  <EOL><DEDENT>endpoint_candidates = [e for e in endpoints if e.endswith(resource)]<EOL>if len(endpoint_candidates) == <NUM_LIT:1>:<EOL><INDENT>return endpoint_candidates[<NUM_LIT:0>]<EOL><DEDENT>return default<EOL>
Calculate the endpoint for this object

    :param brain_or_object: A single catalog brain or content object
    :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
    :returns: Endpoint for this object
    :rtype: string