def get_service_ips(
        service_name,
        task_name=None,
        inactive=False,
        completed=False
):
    """ Get a set of the IPs associated with a service
        :param service_name: the service name
        :type service_name: str
        :param task_name: the task name
        :type task_name: str
        :param inactive: wehther to include inactive services
        :type inactive: bool
        :param completed: whether to include completed services
        :type completed: bool

        :return: a list of IP addresses
        :rtype: [str]
    """

    service_tasks = get_service_tasks(service_name, inactive, completed)

    ips = set([])

    for task in service_tasks:
        if task_name is None or task['name'] == task_name:
            for status in task['statuses']:
                # Only the TASK_RUNNING status will have correct IP information.
                if status["state"] != "TASK_RUNNING":
                    continue

                for ip in status['container_status']['network_infos'][0]['ip_addresses']:
                    ips.add(ip['ip_address'])

    return ips