<s> import random <EOL> import string <EOL> from oscar . core . loading import get_model <EOL> Account = get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def generate ( size = <NUM_LIT:12> , chars = None ) : <EOL> """<STR_LIT>""" <EOL> if chars is None : <EOL> chars = string . ascii_uppercase + string . digits <EOL> code = '<STR_LIT>' . join ( random . choice ( chars ) for x in range ( size ) ) <EOL> try : <EOL> Account . objects . get ( code = code ) <EOL> except Account . DoesNotExist : <EOL> return code <EOL> return generate ( size = size , chars = chars ) </s>
