<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_widget_invalid_options(self, field_name):
 """ Applies additional widget options for an invalid field. This method is called when there is some error on a field to apply additional options on its widget. It does the following: * Sets the aria-invalid property of the widget for accessibility. * Adds an invalid CSS class, which is determined by the returned value of `get_widget_invalid_css_class` method. If a CSS class is returned, it is appended to the current value of the class property of the widget. :param field_name: A field name of the form. """

        field = self.fields[field_name]
        class_name = self.get_widget_invalid_css_class(field_name, field)

        if class_name:
            field.widget.attrs['class'] = join_css_class(
                field.widget.attrs.get('class', None), class_name)

        field.widget.attrs['aria-invalid'] = 'true'