def generate_username(self, user_class):
m = getattr(user_class, '<STR_LIT>', None)<EOL>if m:<EOL><INDENT>return m()<EOL><DEDENT>else:<EOL><INDENT>max_length = user_class._meta.get_field(<EOL>self.username_field).max_length<EOL>return uuid.uuid4().hex[:max_length]<EOL><DEDENT>
Generate a new username for a user