'Return the approved Document the URL represents, None if there isn\'t
one.
Return None if the URL is a 404, the URL doesn\'t point to the right
view, or the indicated document doesn\'t exist.
To limit the universe of discourse to a certain locale, pass in a
`required_locale`. To fetch only the ID of the returned Document, set
`id_only` to True.
If the URL has a host component, we assume it does not point to this
host and thus does not point to a Document, because that would be a
needlessly verbose way to specify an internal link. However, if you
pass check_host=False, we assume the URL\'s host is the one serving
Documents, which comes in handy for analytics whose metrics return
host-having URLs.'

@classmethod
def from_url(cls, url, required_locale=None, id_only=False, check_host=True):

    try:
        components = _doc_components_from_url(url, required_locale=required_locale, check_host=check_host)
    except _NotDocumentView:
        return None
    if (not components):
        return None
    (locale, path, slug) = components
    doc = cls.objects
    if id_only:
        doc = doc.only('id')
    try:
        doc = doc.get(locale=locale, slug=slug)
    except cls.DoesNotExist:
        try:
            doc = doc.get(locale=settings.WIKI_DEFAULT_LANGUAGE, slug=slug)
            translation = doc.translated_to(locale)
            if translation:
                return translation
            return doc
        except cls.DoesNotExist:
            return None
    return doc
