def get_doc(mod_obj):
    """
    Gets document-name and reference from input module object safely
    :param mod_obj: module object
    :return: documentation of module object if it exists.
    """
    try:
        doc_name = mod_obj.get('document-name')
        ref = mod_obj.get('reference')
        if ref and doc_name:
            return '<a href="' + ref + '">' + doc_name + '</a>'
        elif ref:
            return '<a href="' + ref + '">' + ref + '</a>'
        elif doc_name:
            return doc_name
    except Exception as e:
        raise Exception(e)
    return 'N/A'