<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def manage_payload_services(action, services=None, charm_func=None):
 """Run an action against all services. An optional charm_func() can be called. It should raise an Exception to indicate that the function failed. If it was succesfull it should return None or an optional message. The signature for charm_func is: charm_func() -> message: str charm_func() is executed after any services are stopped, if supplied. The services object can either be: - None : no services were passed (an empty dict is returned) - a list of strings - A dictionary (optionally OrderedDict) {service_name: {'service': ..}} :param action: Action to run: pause, resume, start or stop. :type action: str :param services: See above :type services: See above :param charm_func: function to run for custom charm pausing. :type charm_func: f() :returns: Status boolean and list of messages :rtype: (bool, []) :raises: RuntimeError """

    actions = {
        'pause': service_pause,
        'resume': service_resume,
        'start': service_start,
        'stop': service_stop}
    action = action.lower()
    if action not in actions.keys():
        raise RuntimeError(
            "action: {} must be one of: {}".format(action,
                                                   ', '.join(actions.keys())))
    services = _extract_services_list_helper(services)
    messages = []
    success = True
    if services:
        for service in services.keys():
            rc = actions[action](service)
            if not rc:
                success = False
                messages.append("{} didn't {} cleanly.".format(service,
                                                               action))
    if charm_func:
        try:
            message = charm_func()
            if message:
                messages.append(message)
        except Exception as e:
            success = False
            messages.append(str(e))
    return success, messages