def escapise(comnd):
    """Escape special characters in command.

    Any special characters would have arrived here by having been escaped in the command line.
    To log the command in a way it can be reused as-is, escapes must be re-added.

    Args:
        comnd[str]: List of strings to sanitise.
    Returns:
        [str]
    """
    for i,c in enumerate(comnd):
        # Sometimes an empty string is an argument. That needs to be quoted for the log.
        if c == '':
            comnd[i] = '\'\''
        else:
            comnd[i] = c.translate(str.maketrans({"\\": r"\\",
                                                  "\"": r"\"",
                                                  "\'": r"\'",
                                                  "$": r"\$",
                                                  "\t": r"$'\t'",
                                                  ">": r"\>",
                                                  "<": r"\<",
                                                  "|": r"\|",
                                                  "*": r"\*",
                                                  "#": r"\#",
                                                  "%": r"\%"}))
    return comnd