'Add a username field to a form description.
Arguments:
form_desc: A form description
Keyword Arguments:
required (bool): Whether this field is required; defaults to True'

def _add_username_field(self, form_desc, required=True):

    username_label = _(u'Public    Username')
    username_instructions = _(u'The    name    that    will    identify    you    in    your    courses.    It    cannot    be    changed    later.')
    username_placeholder = _(u'Jane_Q_Learner')
    form_desc.add_field('username', label=username_label, instructions=username_instructions, placeholder=username_placeholder, restrictions={'min_length': accounts.USERNAME_MIN_LENGTH, 'max_length': accounts.USERNAME_MAX_LENGTH}, required=required)
