from dcos import (marathon, mesos, package, util)
from dcos.errors import DCOSException


def get_service(service_name, inactive=False, completed=False):
    services = mesos.get_master().frameworks(inactive=inactive, completed=completed)

    for service in services:
        if service['name'] == service_name:
            return service

    return False


def get_service_framework_id(service_name, inactive=False, completed=False):
    service = get_service(service_name, inactive, completed)

    if service and service['id']:
        return service['id']

    return False


def get_service_tasks(service_name, inactive=False, completed=False):
    service = get_service(service_name, inactive, completed)

    if service and service['tasks']:
        return service['tasks']

    return False

from dcos import mesos


def get_service(service_name, inactive=False, completed=False):
    services = mesos.get_master().frameworks(inactive=inactive, completed=completed)

    for service in services:
        if service['name'] == service_name:
            return service

    return None


def get_service_framework_id(service_name, inactive=False, completed=False):
    service = get_service(service_name, inactive, completed)

    if service is not None and service['id']:
        return service['id']

    return None


def get_service_tasks(service_name, inactive=False, completed=False):
    service = get_service(service_name, inactive, completed)

    if service is not None and service['tasks']:
        return service['tasks']

    return []

Return None or Empty List
Return None or Empty List

Return None when an object cannot be found or an empty list when a list
type is expected.
