def turn_on_maintenance_mode(computer_id, duration, api, configuration, api_version, api_exception):
    """ Turns on maintenance mode on a computer.

    :param computer_id: The ID of the computer.
    :param duration: The maintenance mode duration.
    :param api: The Deep Security API modules.
    :param configuration: Configuration object to pass to the api client.
    :param api_version: The version of the API to use.
    :param api_exception: The Deep Security API exception module.
    :return: A Computer object.
    """

    # Create and configure an ApplicationControlComputerExtesnion object
    application_control = api.ApplicationControlComputerExtension()
    application_control.maintenance_mode_status = "on"
    application_control.maintenance_mode_duration = duration

    # Add the ApplicationControlComputerExtension to a Computer object
    computer = api.Computer()
    computer.application_control_computer_extension = application_control

    try:
        # Update the computer
        computers_api = api.ComputersApi(api.ApiClient(configuration))
        return computers_api.modify_computer(computer_id, computer, api_version)
        
    except api_exception as e:
        return "Exception: " + str(e)