def parse_sstat_nodes(output, job_id):
    """Parse and return the sstat command

    This function parses and returns the nodes of
    a job in a list with the duplicates removed.

    :param output: output of the sstat command
    :type output: str
    :return: compute nodes of the allocation or job
    :rtype: list of str
    """
    nodes = []
    for line in output.split("\n"):
        sstat_string = line.split("|")

        # sometimes there are \n that we need to ignore
        if len(sstat_string) >= 2:
            if sstat_string[0].startswith(job_id):
                node = sstat_string[1]
                nodes.append(node)
    return list(set(nodes))