def _relative_time_string(time_seconds, no_ms=False):
    """Converts the given `time_seconds` into a relative, human-readable
    string representation.

    Args:
        time_seconds (int or float): The relative time to convert
        no_ms (bool): If set the `999ms` style representation is not chosen

    Returns:
        String: The string representation is chosen on the value of
                seconds to be either of the form `999ms`, `99.9s`,
                `59:59m`, or `99:59:59h`. If `None` is supplied, `-`
                is returned.
    """
    if time_seconds == None:
        return "-"

    milliseconds = int(time_seconds * 1000.0)
    if abs(milliseconds) < 1000 and not no_ms:
        return "%dms" % milliseconds

    seconds = time_seconds
    if abs(seconds) < 100.0:
        return "%.1fs" % (seconds)

    minutes = int(seconds / 60)
    seconds = abs(seconds - minutes * 60)
    if abs(minutes) < 60:
        return "%d:%02dm" % (minutes, seconds)

    hours = int(minutes / 60)
    minutes = abs(minutes - hours * 60)
    return "%d:%02d:%02dh" % (hours, minutes, seconds)