def METHOD_NAME(context, page, fallback=None):
    """
    Outputs a page's URL as relative (/foo/bar/) if it's within the same site as the
    current page, or absolute (http://example.com/foo/bar/) if not.
    If kwargs contains a fallback view name and page is None, the fallback view url will be returned.
    """
    if page is None and fallback:
        return resolve_url(fallback)
    if not isinstance(page, Page):
        raise ValueError("pageurl tag expected a Page object, got %r" % page)
    return page.get_url(request=context.get("request"))