def METHOD_NAME(request, **kwargs):
    document_id = request.validated['document_id']
    lang = request.validated['lang']
    locale = DBSession.query(DocumentLocale) \
        .filter(DocumentLocale.document_id == document_id) \
        .filter(DocumentLocale.lang == lang) \
        .one_or_none()
    if locale is None:
        request.errors.add('body',
                           '{}/{}'.format(document_id, lang),
                           'Document not found')
        return
    request.validated['locale'] = locale
    document = DBSession.query(Document) \
        .filter(Document.document_id == document_id) \
        .one_or_none()
    if document is None:
        request.errors.add('body',
                           '{}/{}'.format(document_id, lang),
                           'Document not found')
        return
    request.validated['document'] = document
    if locale.topic_id is not None:
        request.errors.add('body',
                           '{}_{}'.format(document_id, lang),
                           'Topic already exists',
                           topic_id=locale.topic_id)