Return the status for a service.
    If the name contains globbing, a dict mapping service name to PID or empty
    string is returned.

    .. versionchanged:: 2018.3.0
        The service name can now be a glob (e.g. ``salt*``)

    Args:
        name (str): The name of the service to check
        sig (str): Signature to use to find the service via ps

    Returns:
        string: PID if running, empty otherwise
        dict: Maps service name to PID if running, empty string otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.status <service name> [service signature]

def status(name, sig=None):
    '''
    Return the status for a service.
    If the name contains globbing, a dict mapping service name to PID or empty
    string is returned.

    .. versionchanged:: 2018.3.0
        The service name can now be a glob (e.g. ``salt*``)

    Args:
        name (str): The name of the service to check
        sig (str): Signature to use to find the service via ps

    Returns:
        string: PID if running, empty otherwise
        dict: Maps service name to PID if running, empty string otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.status <service name> [service signature]
    '''
    if sig:
        return __salt__['status.pid'](sig)

    contains_globbing = bool(re.search(r'\*|\?|\[.+\]', name))
    if contains_globbing:
        services = fnmatch.filter(get_all(), name)
    else:
        services = [name]
    results = {}
    for service in services:
        results[service] = __salt__['status.pid'](service)
    if contains_globbing:
        return results
    return results[name]