def lookup_newsletter_recipients(resource):
    """
        Callback function to look up the recipients corresponding to a
        distribution list entry (in this instance: send all newsletters
        to orgs)

        Args:
            the (filtered) resource

        Returns:
            a list of pe_ids of the recipients
    """

    if resource.tablename == "cr_shelter":
        rows = resource.select(["organisation_id$pe_id"], as_rows=True)
        return [row.org_organisation.pe_id for row in rows]

    elif resource.tablename == "org_organisation":
        rows = resource.select(["pe_id"], as_rows=True)
        return [row.pe_id for row in rows]

    else:
        return []