@classmethod<EOL><INDENT>def create_new_code(cls,**kwargs):<DEDENT>
prefix = kwargs.pop('<STR_LIT>','<STR_LIT>')<EOL>new = False<EOL>while not new:<EOL><INDENT>random_string = '<STR_LIT>'.join(random.choice(string.ascii_uppercase) for z in range(<NUM_LIT:10>))<EOL>if not Voucher.objects.filter(voucherId='<STR_LIT>' % (prefix, random_string)).exists():<EOL><INDENT>new = True<EOL><DEDENT><DEDENT>return Voucher.objects.create(voucherId='<STR_LIT>' % (prefix, random_string),**kwargs)<EOL>
Creates a new Voucher with a unique voucherId