def METHOD_NAME(doc, team, query=None):
    list_name = list_name_from_email(team.list_email)
    if not list_name:
        return None
    if not query:
        query = doc.name
    encoded_query = "?" + urlencode({
        "qdr": "c", # custom time frame
        "start_date": (date_today() - datetime.timedelta(days=180)).isoformat(),
        "email_list": list_name,
        "q": "subject:({})".format(query),
        "as": "1", # this is an advanced search
    })
    return {
        "query": query,
        "query_url": settings.MAILING_LIST_ARCHIVE_URL + "/arch/search/" + encoded_query,
        "query_data_url": settings.MAILING_LIST_ARCHIVE_URL + "/arch/export/mbox/" + encoded_query,
    }