def uninstall_package(
        package_name,
        service_name=None,
        all_instances=False,
        wait_for_completion=False,
        timeout_sec=600
):
    """ Uninstall a package using the DC/OS library.

        :param package_name: name of the package
        :type package_name: str
        :param service_name: unique service name for the package
        :type service_name: str
        :param all_instances: uninstall all instances of package
        :type all_instances: bool
        :param wait_for_completion: whether or not to wait for task completion before returning
        :type wait_for_completion: bool
        :param timeout_sec: number of seconds to wait for task completion
        :type timeout_sec: int

        :return: True if uninstall was successful, False otherwise
        :rtype: bool
    """

    package_manager = _get_package_manager()
    pkg = package_manager.get_package_version(package_name, None)

    try:
        if service_name is None:
            service_name = _get_service_name(package_name, pkg)

        print("{}uninstalling package '{}' with service name '{}'\n".format(
            shakedown.cli.helpers.fchr('>>'), package_name, service_name))

        package_manager.uninstall_app(package_name, all_instances, service_name)

        # Optionally wait for the service to unregister as a framework
        if wait_for_completion:
            wait_for_mesos_task_removal(service_name, timeout_sec=timeout_sec)
    except errors.DCOSException as e:
        print('\n{}{}'.format(
            shakedown.cli.helpers.fchr('>>'), e))

    # Uninstall subcommands (if defined)
    if pkg.cli_definition():
        print("{}uninstalling CLI commands for package '{}'".format(
            shakedown.cli.helpers.fchr('>>'), package_name))
        subcommand.uninstall(package_name)

    return True