def last_name(languages=None):
choices = []<EOL>languages = languages or ['<STR_LIT>']<EOL>for lang in languages:<EOL><INDENT>samples = _get_lastnames(lang)<EOL>choices.extend(samples)<EOL><DEDENT>return random.choice(choices).title()<EOL>
return a random last name

>>> from mock import patch
>>> with patch('%s._get_lastnames' % __name__, lambda *args: ['aaa']):
...     last_name()
'Aaa'
>>> with patch('%s.get_lastnames' % __name__, lambda lang: ['%s_lastname'% lang]):
...     last_name(['it'])
'It_Lastname'