human
Complete this python program:
def emails_with_users_and_watches(subject, text_template, html_template, context_vars, users_and_watches, from_email=settings.TIDINGS_FROM_ADDRESS, default_locale=settings.WIKI_DEFAULT_LANGUAGE, **extra_kwargs):
assistant
#Here is the Python code you requested.

    """Return iterable of EmailMessages with user and watch values substituted.
    A convenience function for generating emails by repeatedly
    rendering a Django template with the given ``context_vars`` plus a
    ``user`` and ``watches`` key for each pair in ``users_and_watches``
    .. Note::
    This is a locale-aware re-write of the same function in django-tidings.
    It\s kind of goofy--I ain\t gonna lie.
    :arg subject: lazy gettext subject string
    :arg text_template: path to text template file
    :arg html_template: path to html template file
    :arg context_vars: a map which becomes the Context passed in to the
    template and the subject string
    :arg from_email: the from email address
    :arg default_local: the local to default to if not user.locale
    :arg extra_kwargs: additional kwargs to pass into EmailMessage constructor
    :returns: generator of EmailMessage objects
    """
    @safe_translation
    def _make_mail(locale, user, watch):
        context_vars['user'] = user
        context_vars['watch'] = watch[0]
        context_vars['watches'] = watch
        msg = EmailMultiAlternatives((subject % context_vars), render_email(text_template, context_vars), from_email, [user.email], **extra_kwargs)
        if html_template:
            msg.attach_alternative(render_email(html_template, context_vars), 'text/html')
        return msg
    for (user, watch) in users_and_watches:
        if hasattr(user, 'locale'):
            locale = user.locale
        else:
            locale = default_locale
        (yield _make_mail(locale, user, watch))