<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _determine_os_workload_status( configs, required_interfaces, charm_func=None, services=None, ports=None):
 """Determine the state of the workload status for the charm. This function returns the new workload status for the charm based on the state of the interfaces, the paused state and whether the services are actually running and any specified ports are open. This checks: 1. if the unit should be paused, that it is actually paused. If so the state is 'maintenance' + message, else 'broken'. 2. that the interfaces/relations are complete. If they are not then it sets the state to either 'broken' or 'waiting' and an appropriate message. 3. If all the relation data is set, then it checks that the actual services really are running. If not it sets the state to 'broken'. If everything is okay then the state returns 'active'. @param configs: a templating.OSConfigRenderer() object @param charm_func: a callable function that returns state, message. The signature is charm_func(configs) -> (state, message) @param services: list of strings OR dictionary specifying services/ports @param ports: OPTIONAL list of port numbers. @returns state, message: the new workload status, user message """

    state, message = _ows_check_if_paused(services, ports)

    if state is None:
        state, message = _ows_check_generic_interfaces(
            configs, required_interfaces)

    if state != 'maintenance' and charm_func:
        # _ows_check_charm_func() may modify the state, message
        state, message = _ows_check_charm_func(
            state, message, lambda: charm_func(configs))

    if state is None:
        state, message = _ows_check_services_running(services, ports)

    if state is None:
        state = 'active'
        message = "Unit is ready"
        juju_log(message, 'INFO')

    return state, message