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.

+ from dcos import mesos
- 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
+     return None
  
  
  def get_service_framework_id(service_name, inactive=False, completed=False):
      service = get_service(service_name, inactive, completed)
  
-     if service and service['id']:
+     if service is not None and service['id']:
          return service['id']
  
-     return False
+     return None
  
  
  def get_service_tasks(service_name, inactive=False, completed=False):
      service = get_service(service_name, inactive, completed)
  
-     if service and service['tasks']:
+     if service is not None and service['tasks']:
          return service['tasks']
  
-     return False
+     return []
  
Return None or Empty List
## Code Before:
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

## Instruction:
Return None or Empty List
## Code After:
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 []
