def send_tng_email(profile, now=None):
    print "at top of send_tng_email"
    status = "started"
    if not now:
        now = datetime.datetime.utcnow()

    if os.getenv("ENVIRONMENT", "testing") is "production":
        email = profile.email
    else:
        email = "heather@impactstory.org"
    profile.last_email_sent = now
    db.session.merge(profile)

    try:
        db.session.commit()
    except InvalidRequestError:
        logger.info(u"rollback, trying again to update profile object in send_email_report for {url_slug}".format(url_slug=profile.url_slug))
        db.session.rollback()
        db.session.commit()

    print "here now"

    report = tng_report.make(profile)
    if report["profile"]:

        if profile.is_live:
            if profile.orcid_id:
                msg = emailer.send(email, "News about live Impactstory; you have an orcid", "tng_announcement", report)
            else:
                msg = emailer.send(email, "News about live Impactstory; you don't have an orcid", "tng_announcement", report)
        else:
            if profile.orcid_id:
                msg = emailer.send(email, "News about trial Impactstory; you have an orcid", "tng_announcement", report)
            else:
                msg = emailer.send(email, "News about trial Impactstory; you don't have an orcid", "tng_announcement", report)

    status = "email sent"
    logger.info(u"SENT EMAIL to {url_slug}!!".format(url_slug=profile.url_slug))

    return status
dataset/ETHPy150Open Impactstory/total-impact-webapp/tasks.py/send_tng_email/operator `==` -> `is`