<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def name_generator(names=None):
 """Creates a generator for generating names. :arg names: list or tuple of names you want to use; defaults to ENGLISH_MONARCHS :returns: generator for names Example:: from eadred.helpers import name_generator gen = name_generator() for i in range(50):
 mymodel = SomeModel(name=gen.next()) mymodel.save() Example 2: u'James II' u'Stephen of Blois' u'James I' .. Note:: This gives full names for a "name" field. It's probably not useful for broken down name fields like "firstname", "lastname", etc. """

    if names is None:
        names = ENGLISH_MONARCHS

    while True:
        yield text_type(random.choice(names))