def doc_urls_to_string(doc_urls, queryset=False):
    """
    Args:
        doc_urls: [{"name": "wiki", "url": "http://www.wiki.com"}, ...] OR
        doc_urls: [models.DocUrl] (if queryset=True)
    Returns:
        '(wiki, http://www.wiki.com), ...'
    """
    if queryset:
        new_doc_urls = [(i.name, i.url) for i in doc_urls]
    else:
        new_doc_urls = [(i['name'], i['url']) for i in doc_urls]
    return str(sorted(new_doc_urls))