def _safe_mesos_dns_taskname(task_name):
    """Converts a potentially slash-delimited task name to one that works for '.mesos' task names
    Mesos DNS task names handle folders like this: /path/to/myservice => myservice-to-path"""
    elems = task_name.strip("/").split("/")
    elems.reverse()
    return "-".join(elems)