@quickcache(['domain', 'app_id', 'xmlns'], timeout=30)
def forms_have_multimedia(domain, app_id, xmlns):
    """
    :return: True if there is multimedia for forms with the given app_id and xmlns.
    """
    startkey = [domain, app_id, xmlns]
    rows = XFormInstance.get_db().view(
        'attachments/attachments',
        startkey=startkey,
        endkey=startkey + [{}],
        group_level=3,
        reduce=True,
        group=True
    )

    return rows.count() > 0
dataset/ETHPy150Open dimagi/commcare-hq/corehq/couchapps/dbaccessors.py/forms_have_multimedia/original