Helper function that will wait for the status of the service to match the
    provided status before an end time expires. Used for service stop and start

    .. versionadded:: 2017.7.9,2018.3.4

    Args:
        service_name (str):
            The name of the service

        end_time (float):
            A future time. e.g. time.time() + 10

        service_states (list):
            Services statuses to wait for as returned by info()

    Returns:
        dict: A dictionary containing information about the service.

    :codeauthor: Damon Atkins <https://github.com/damon-atkins>

def _status_wait(service_name, end_time, service_states):
    '''
    Helper function that will wait for the status of the service to match the
    provided status before an end time expires. Used for service stop and start

    .. versionadded:: 2017.7.9,2018.3.4

    Args:
        service_name (str):
            The name of the service

        end_time (float):
            A future time. e.g. time.time() + 10

        service_states (list):
            Services statuses to wait for as returned by info()

    Returns:
        dict: A dictionary containing information about the service.

    :codeauthor: Damon Atkins <https://github.com/damon-atkins>
    '''
    info_results = info(service_name)

    while info_results['Status'] in service_states and time.time() < end_time:
        # From Microsoft: Do not wait longer than the wait hint. A good interval
        # is one-tenth of the wait hint but not less than 1 second and not more
        # than 10 seconds.
        # https://docs.microsoft.com/en-us/windows/desktop/services/starting-a-service
        # https://docs.microsoft.com/en-us/windows/desktop/services/stopping-a-service
        # Wait hint is in ms
        wait_time = info_results['Status_WaitHint']
        # Convert to seconds or 0
        wait_time = wait_time / 1000 if wait_time else 0
        if wait_time < 1:
            wait_time = 1
        elif wait_time > 10:
            wait_time = 10

        time.sleep(wait_time)
        info_results = info(service_name)

    return info_results