human
Complete this python program:
def hrm_training_controller():
assistant
#Here is the Python program you requested.

    """Training Controller, defined in the model for use from
    multiple controllers for unified menus
    - used for Searching for Participants
    - used for Adding/Editing on Profile page
    """
    s3db = current.s3db
    def prep(r):
        method = r.method
        if (r.interactive or (r.representation == 'aadata')):
            s3db.configure('hrm_training', listadd=False)
            if (method in ('create', 'update')):
                person_id = r.get_vars.get('~.person_id', None)
                if person_id:
                    field = s3db.hrm_training.person_id
                    field.default = person_id
                    field.readable = field.writable = False
        if (method == 'report'):
            s3db.configure('hrm_training', extra_fields=['date'])
            table = s3db.hrm_training
            table.year = Field.Method('year', hrm_training_year)
            table.month = Field.Method('month', hrm_training_month)
        return True
    current.response.s3.prep = prep
    return current.rest_controller('hrm', 'training', csv_stylesheet=('hrm', 'training.xsl'), csv_template=('hrm', 'training'), csv_extra_fields=[dict(label='Training    Event', field=s3db.hrm_training.training_event_id)])