@staticmethod
def _slug_is_available(slug, parent_page, page=None):
    """
        Determine whether the given slug is available for use on a child page of
        parent_page. If 'page' is passed, the slug is intended for use on that page
        (and so it will be excluded from the duplicate check).
        """
    if parent_page is None:
        return True
    siblings = parent_page.get_children()
    if page:
        siblings = siblings.not_page(page)
    return not siblings.filter(slug=slug).exists()
