def fail_if_missing(module, found, service, msg=''):
    """
    This function will return an error or exit gracefully depending on check mode status
    and if the service is missing or not.

    :arg module: is an  AnsibleModule object, used for it's utility methods
    :arg found: boolean indicating if services was found or not
    :arg service: name of service
    :kw msg: extra info to append to error/success msg when missing
    """
    if not found:
        if module.check_mode:
            module.exit_json(msg=
                'Service %s not found on %s, assuming it will exist on full run'
                 % (service, msg), changed=True)
        else:
            module.fail_json(msg=
                'Could not find the requested service %s: %s' % (service, msg))
