# Path: shakedown/dcos/service.py
# def service_available_predicate(service_name):
#     url = dcos_service_url(service_name)
#     try:
#         response = http.get(url)
#         return response.status_code == 200
#     except Exception as e:
#         return False


from distutils.version import LooseVersion
from dcos import marathon, config
from shakedown.dcos.spinner import *
from shakedown.dcos.service import service_available_predicate
from shakedown import *
from six.moves import urllib
import pytest


def marthon_version_less_than(version):
    return marathon_version() < LooseVersion(version)


def mom_version(name='marathon-user'):
    """Returns the version of marathon on marathon.
    """
    if service_available_predicate(name):
        with marathon_on_marathon(name):
                return marathon_version()
    else:
        # We can either skip the corresponding test by returning False
        # or raise an exception.
        print('WARN: {} MoM not found. Version is None'.format(name))
        return None


def mom_version_less_than(version, name='marathon-user'):
    """ Returns True if MoM with the given {name} exists and has a version less
        than {version}. Note that if MoM does not exist False is returned.

        :param version: required version
        :type: string
        :param name: MoM name, default is 'marathon-user'
        :type: string
        :return: True if version < MoM version
        :rtype: bool
    """

# Path: shakedown/dcos/service.py
# def service_available_predicate(service_name):
#     url = dcos_service_url(service_name)
#     try:
#         response = http.get(url)
#         return response.status_code == 200
#     except Exception as e:
#         return False


# Path: shakedown/dcos/marathon.py
from distutils.version import LooseVersion
from dcos import marathon, config
from shakedown.dcos.spinner import *
from shakedown.dcos.service import service_available_predicate
from shakedown import *
from six.moves import urllib
import pytest



def marthon_version_less_than(version):
    return marathon_version() < LooseVersion(version)


def mom_version(name='marathon-user'):
    """Returns the version of marathon on marathon.
    """
    if service_available_predicate(name):
        with marathon_on_marathon(name):
                return marathon_version()
    else:
        # We can either skip the corresponding test by returning False
        # or raise an exception.
        print('WARN: {} MoM not found. Version is None'.format(name))
        return None


def mom_version_less_than(version, name='marathon-user'):
    """ Returns True if MoM with the given {name} exists and has a version less
        than {version}. Note that if MoM does not exist False is returned.

        :param version: required version
        :type: string
        :param name: MoM name, default is 'marathon-user'
        :type: string
        :return: True if version < MoM version
        :rtype: bool
    """

    if service_available_predicate(name):